JBoss Tools SVN: r7693 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-04-22 18:28:25 -0400 (Tue, 22 Apr 2008)
New Revision: 7693
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/build.properties
Log:
Hibernate Proposals icon
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/build.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/build.properties 2008-04-22 21:16:50 UTC (rev 7692)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/build.properties 2008-04-22 22:28:25 UTC (rev 7693)
@@ -2,5 +2,6 @@
output.. = build/eclipse/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ icons/
src.includes = icons/
17 years, 8 months
JBoss Tools SVN: r7692 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-04-22 17:16:50 -0400 (Tue, 22 Apr 2008)
New Revision: 7692
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.50.default.ports.properties
Log:
JBIDE-2053 - yeah!
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.50.default.ports.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.50.default.ports.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.50.default.ports.properties 2008-04-22 21:16:50 UTC (rev 7692)
@@ -0,0 +1,17 @@
+# As much as possible, try to create file patterns that match
+# as few files as possible. Each matching file *WILL* be scanned
+# and cached, regardless of if there's a match.
+
+JNDI=//server/mbean[@name='jboss:service=Naming']/attribute[@name='Port']
+JNDI_FILE=conf/jboss-service.xml
+JBoss_Web=//Server/Service[@name='jboss.web']/Connector[count(@sslProtocol) = 0 and (count(@protocol) = 0 or @protocol = 'HTTP/1.1')]
+JBoss_Web_ATTRIBUTE=port
+JBoss_Web_FILE=deployers/jbossweb.deployer/server.xml
+JNDI_RMI=//server/mbean[@name='jboss:service=Naming']/attribute[@name='RmiPort']
+JNDI_RMI_FILE=conf/jboss-service.xml
+JRMP_Invoker=//server/mbean[@name='jboss:service=invoker,type=jrmp']/attribute[@name='RMIObjectPort']
+JRMP_Invoker_FILE=conf/jboss-service.xml
+Pooled_Invoker=//server/mbean[@name='jboss:service=invoker,type=pooled']/attribute[@name='ServerBindPort']
+Pooled_Invoker_FILE=conf/jboss-service.xml
+Web_Services=//server/mbean[@name='jboss:service=WebService']/attribute[@name='Port']
+Web_Services_FILE=conf/jboss-service.xml
17 years, 8 months
JBoss Tools SVN: r7690 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-04-22 12:04:37 -0400 (Tue, 22 Apr 2008)
New Revision: 7690
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2090 ConcurrentModificationException occurs during the Seam validation
Clean up is performed on debug output.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.java 2008-04-22 16:00:25 UTC (rev 7689)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.java 2008-04-22 16:04:37 UTC (rev 7690)
@@ -711,7 +711,6 @@
}
if (fType == null) {
- System.out.println(Thread.currentThread().getId() + ":" + Thread.currentThread() + "<<< TypeInfoCollector<Init>");
return;
}
try {
17 years, 8 months
JBoss Tools SVN: r7689 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-22 12:00:25 -0400 (Tue, 22 Apr 2008)
New Revision: 7689
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java
Log:
JBIDE-2060
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java 2008-04-22 16:00:18 UTC (rev 7688)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java 2008-04-22 16:00:25 UTC (rev 7689)
@@ -121,10 +121,10 @@
if(!Flags.isPublic(ms[i].getFlags())) continue;
String n = ms[i].getElementName();
boolean isProperty = false;
- if((n.startsWith("get") || n.startsWith("set")) && n.length() > 3) {
+ if((isGetter(ms[i], "get") || isSetter(ms[i])) && n.length() > 3) {
n = n.substring(3, 4).toLowerCase() + n.substring(4);
isProperty = true;
- } else if(n.startsWith("is") && n.length() > 2) {
+ } else if(isGetter(ms[i], "is")) {
String typeName = EclipseJavaUtil.getMemberTypeAsString(ms[i]);
if("boolean".equals(typeName) || "java.lang.Boolean".equals(typeName)) {
n = n.substring(2, 3).toLowerCase() + n.substring(3);
@@ -197,5 +197,35 @@
if(isLoading) addChild_0(c); else addChild(c);
return c;
}
+
+ private boolean isGetter(IMethod method, String pref) {
+ if(method == null) return false;
+ String name = method.getElementName();
+ if(!name.startsWith(pref) || name.length() <= pref.length()) return false;
+ try {
+ String[] ps = method.getParameterNames();
+ if(ps == null || ps.length != 0) return false;
+ String t = EclipseJavaUtil.getMemberTypeAsString(method);
+ if(t == null || t.equals("void")) return false;
+ } catch (JavaModelException e) {
+ return false;
+ }
+
+ return true;
+ }
+ private boolean isSetter(IMethod method) {
+ if(method == null) return false;
+ String name = method.getElementName();
+ if(!name.startsWith("set") || name.length() <= 3) return false;
+ try {
+ String[] ps = method.getParameterNames();
+ if(ps == null || ps.length != 1) return false;
+ } catch (JavaModelException e) {
+ return false;
+ }
+
+ return true;
+ }
+
}
17 years, 8 months
JBoss Tools SVN: r7688 - in trunk/jsf/tests/org.jboss.tools.jsf.test: src/org/jboss/tools/jsf/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-22 12:00:18 -0400 (Tue, 22 Apr 2008)
New Revision: 7688
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStart1/JavaSource/demo/User.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFBeansTest.java
Log:
JBIDE-2060
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStart1/JavaSource/demo/User.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStart1/JavaSource/demo/User.java 2008-04-22 14:28:23 UTC (rev 7687)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStart1/JavaSource/demo/User.java 2008-04-22 16:00:18 UTC (rev 7688)
@@ -30,4 +30,16 @@
public void setName(String name) {
this.name = name;
}
+
+ public void getX1() {
+
+ }
+
+ public String getX2(int i) {
+ return "";
+ }
+
+ public void setX3(int i, int j) {
+
+ }
}
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFBeansTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFBeansTest.java 2008-04-22 14:28:23 UTC (rev 7687)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFBeansTest.java 2008-04-22 16:00:18 UTC (rev 7688)
@@ -6,9 +6,13 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.test.util.TestProjectProvider;
+import org.jboss.tools.jsf.model.pv.JSFProjectsRoot;
+import org.jboss.tools.jsf.model.pv.JSFProjectsTree;
+import org.jboss.tools.jst.web.model.pv.WebProjectNode;
import org.jboss.tools.jst.web.project.list.IWebPromptingProvider;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
@@ -39,7 +43,16 @@
assertNotNull("No results for bean " + " user.", n.getModel());
assertTrue("Property 'parent' inherited from super class is not found in bean 'user'", result.contains("parent"));
+
}
+
+ public void testGettersAndSetters() {
+ IModelNature n = EclipseResourceUtil.getModelNature(project);
+ List<Object> result = WebPromptingProvider.getInstance().getList(n.getModel(), IWebPromptingProvider.JSF_BEAN_METHODS, "user.", new Properties());
+ assertTrue("Method getX1 is not found. It is not a getter because it has type void.", result.contains("getX1"));
+ assertTrue("Method getX2 is not found. It is not a getter because it has a parameter.", result.contains("getX2"));
+ assertTrue("Method setX3 is not found. It is not a setter because it has 2 parameters", result.contains("setX3"));
+ }
protected void tearDown() throws Exception {
if(provider != null) {
17 years, 8 months
JBoss Tools SVN: r7687 - trunk/common/plugins/org.jboss.tools.common.model/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-04-22 10:28:23 -0400 (Tue, 22 Apr 2008)
New Revision: 7687
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
Log:
JBIDE-2104
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2008-04-22 14:28:17 UTC (rev 7686)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2008-04-22 14:28:23 UTC (rev 7687)
@@ -1227,8 +1227,7 @@
<XModelAttribute default="Visual/Source" name="option list" xmlname="option_list">
<Constraint loader="List">
<value name="Visual/Source"/>
- <value name="Source"/>
- <value name="Visual"/>
+ <value name="Preview"/>
</Constraint>
<Editor name="List"/>
</XModelAttribute>
17 years, 8 months
JBoss Tools SVN: r7686 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-04-22 10:28:17 -0400 (Tue, 22 Apr 2008)
New Revision: 7686
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
Log:
JBIDE-2104
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-04-22 14:06:42 UTC (rev 7685)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-04-22 14:28:17 UTC (rev 7686)
@@ -74,8 +74,6 @@
import org.jboss.tools.common.model.util.XModelTreeListenerSWTSync;
import org.jboss.tools.common.text.ext.IMultiPageEditor;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.editor.IVisualContext;
-import org.jboss.tools.jst.jsp.editor.IVisualController;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
import org.jboss.tools.jst.jsp.editor.IVisualEditorFactory;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
@@ -89,14 +87,15 @@
IReusableEditor, ITextEditorExtension, ITextEditorExtension2,
ITextEditorExtension3, INavigationLocationProvider, IMultiPageEditor {
- private static final String VISUALSOURCE_TAB_LABEL = "JSPMultiPageEditor.TabLabel.VisualSource";
+ private static final String VISUALSOURCE_TAB_LABEL = "JSPMultiPageEditor.TabLabel.VisualSource"; //$NON-NLS-1$
- private static final String VISUAL_TAB_LABEL = "JSPMultiPageEditor.TabLabel.Visual";
-
- private static final String SOURCE_TAB_LABEL = "JSPMultiPageEditor.TabLabel.Source";
-
/** PREVIEW_TAB_LABEL */
- private static final String PREVIEW_TAB_LABEL = "JSPMultiPageEditor.TabLabel.Preview";
+ private static final String PREVIEW_TAB_LABEL = "JSPMultiPageEditor.TabLabel.Preview"; //$NON-NLS-1$
+
+ //option loads preview tab
+ private static final String PREVIEW_TAB="Preview"; //$NON-NLS-1$
+ //visual tab
+ private static final String VISUAL_SOURCE_TAB="Visual/Source"; //$NON-NLS-1$
private IVisualEditor visualEditor;
@@ -106,27 +105,25 @@
private JSPTextEditor sourceEditor;
- private int sourceIndex;
-
/** composite control for default web-browser */
//private IVisualEditor previewWebBrowser;
/** index of tab contain default web-browser */
private int previewIndex;
- private boolean osWindows = true;
+// private boolean osWindows = true;
protected XModelTreeListenerSWTSync syncListener = new XModelTreeListenerSWTSync(
this);
- private int oldPage = -1;
+// private int oldPage = -1;
private ConfigurableContentOutlinePage outlinePage = null;
private XModelObject object;
- private QualifiedName persistentTabQualifiedName = new QualifiedName("",
- "Selected_tab");
+ private QualifiedName persistentTabQualifiedName = new QualifiedName("", //$NON-NLS-1$
+ "Selected_tab"); //$NON-NLS-1$
int selectedPageIndex = 0;
@@ -134,12 +131,12 @@
static {
try {
- Bundle b = Platform.getBundle("org.jboss.tools.vpe");
+ Bundle b = Platform.getBundle("org.jboss.tools.vpe"); //$NON-NLS-1$
Class cls = b
- .loadClass("org.jboss.tools.vpe.editor.VpeEditorPartFactory");
+ .loadClass("org.jboss.tools.vpe.editor.VpeEditorPartFactory"); //$NON-NLS-1$
visualEditorFactory = (IVisualEditorFactory) cls.newInstance();
} catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError("Error in loading visual editor factory", e);
+ JspEditorPlugin.getPluginLog().logError("Error in loading visual editor factory", e); //$NON-NLS-1$
}
}
@@ -148,10 +145,10 @@
try {
String q = (file == null) ? null : file.getPersistentProperty(persistentTabQualifiedName);
if (q == null) {
- if ("Source".equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
+ if (VISUAL_SOURCE_TAB.equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
.getValue()))
- selectedPageIndex = 2;
- else if ("Visual"
+ selectedPageIndex = 0;
+ else if (PREVIEW_TAB
.equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
.getValue()))
selectedPageIndex = 1;
@@ -170,14 +167,10 @@
}
}
- protected int getSourcePageIndex() {
- return sourceIndex;
- }
-
private void saveSelectedTab() {
IFile file = getFile();
if(file == null || !file.exists()) return;
- String q = "" + selectedPageIndex;
+ String q = "" + selectedPageIndex; //$NON-NLS-1$
try {
file.setPersistentProperty(persistentTabQualifiedName, q);
} catch (CoreException e) {
@@ -213,33 +206,21 @@
protected void pageChange(int newPageIndex) {
selectedPageIndex = newPageIndex;
- if (osWindows) {
- if (newPageIndex == visualSourceIndex) {
+
+ if (newPageIndex == visualSourceIndex) {
if (visualEditor.getVisualEditor() == null) {
visualEditor.createVisualEditor();
}
visualEditor.setVisualMode(IVisualEditor.VISUALSOURCE_MODE);
- }
- else if (newPageIndex == visualIndex) {
- if (visualEditor.getVisualEditor() == null) {
- visualEditor.createVisualEditor();
- }
- visualEditor.setVisualMode(IVisualEditor.VISUAL_MODE);
- }
- else if (newPageIndex == sourceIndex)
- visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
- else if (newPageIndex == previewIndex) {
+ }else if (newPageIndex == previewIndex) {
if (visualEditor.getPreviewWebBrowser() == null) {
visualEditor.createPreviewBrowser();
}
visualEditor.setVisualMode(IVisualEditor.PREVIEW_MODE);
}
- superPageChange(newPageIndex);
- } else {
- super.pageChange(newPageIndex);
- }
- oldPage = newPageIndex;
+ superPageChange(newPageIndex);
+
}
public void setInput(IEditorInput input) {
@@ -282,7 +263,7 @@
}
public String getContentDescription() {
- return "";
+ return ""; //$NON-NLS-1$
}
/**
@@ -398,43 +379,58 @@
* TODO to author of this class VPE work on linux! this check not need
* in future
*/
- // String os_name = System.getProperty("os.name");
- if (true) {// (os_name.startsWith("Windows")){
- osWindows = true;
- createPagesForWindows();
- } else {
- osWindows = false;
- }
- if (selectedPageIndex == sourceIndex) {
- visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
- // switchOutlineToJSPEditor();
- }
+ createPagesForVPE();
loadSelectedTab();
+
+// if (selectedPageIndex == sourceIndex) {
+// visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
+// // switchOutlineToJSPEditor();
+// }
+// if (selectedPageIndex == 2) {
+// setActivePage(0);
+// pageChange(0);
+// if (visualEditor != null)
+// visualEditor.maximizeSource();
+// selectedPageIndex=0;
+// } else if (selectedPageIndex == 1) {
+// setActivePage(0);
+// pageChange(0);
+// if (visualEditor != null)
+// visualEditor.maximizeVisual();
+// selectedPageIndex=0;
+// } else {
+// selectedPageIndex=0;
+// setActivePage(selectedPageIndex);
+// pageChange(selectedPageIndex);
+// }
+ switch (selectedPageIndex) {
- if (selectedPageIndex == 2) {
- setActivePage(0);
- pageChange(0);
- if (visualEditor != null)
- visualEditor.maximizeSource();
- selectedPageIndex=0;
- } else if (selectedPageIndex == 1) {
- setActivePage(0);
- pageChange(0);
- if (visualEditor != null)
- visualEditor.maximizeVisual();
- selectedPageIndex=0;
- } else {
- selectedPageIndex=0;
+ case 0: {
+ //source/visual mode
setActivePage(selectedPageIndex);
pageChange(selectedPageIndex);
+ break;
+ }
+ case 1: {
+ //preview mode
+ setActivePage(selectedPageIndex);
+ pageChange(selectedPageIndex);
+ break;
}
+ default: {
+ //by default we sets source/visual mode
+ setActivePage(0);
+ pageChange(0);
+ break;
+ }
+ }
new ResourceChangeListener(this, getContainer());
if (getModelObject() != null) {
getModelObject().getModel().addModelTreeListener(syncListener);
}
}
- private void createPagesForWindows() {
+ private void createPagesForVPE() {
sourceEditor = new JSPTextEditor(this);
visualEditor = visualEditorFactory.createVisualEditor(this,
sourceEditor, false);
@@ -508,8 +504,8 @@
}
public void gotoMarker(final IMarker marker) {
- setActivePage(sourceIndex);
- pageChange(sourceIndex);
+ setActivePage(IVisualEditor.VISUALSOURCE_MODE);
+ pageChange(IVisualEditor.VISUALSOURCE_MODE);
IGotoMarker adapter = (IGotoMarker) sourceEditor
.getAdapter(IGotoMarker.class);
if (adapter != null) {
@@ -572,23 +568,19 @@
public Object getAdapter(Class adapter) {
if (IContentOutlinePage.class.equals(adapter)) {
- if (osWindows) {
- if (visualEditor != null) {
- if (outlinePage == null)
- outlinePage = (ConfigurableContentOutlinePage) visualEditor
- .getAdapter(adapter);
- return outlinePage;
- }
- } else {
- if (sourceEditor != null) {
- return sourceEditor.getAdapter(adapter);
- }
+
+ if (visualEditor != null) {
+ if (outlinePage == null)
+ outlinePage = (ConfigurableContentOutlinePage) visualEditor
+ .getAdapter(adapter);
+ return outlinePage;
}
+
} else if (IPropertySheetPage.class.equals(adapter)) {
if (sourceEditor != null)
return sourceEditor.getAdapter(adapter);
} else if (adapter == EditorDescriptor.class)
- return new EditorDescriptor(new String[] { "jsp", "html" });
+ return new EditorDescriptor(new String[] { "jsp", "html" }); //$NON-NLS-1$ //$NON-NLS-2$
if (sourceEditor != null) {
return sourceEditor.getAdapter(adapter);
17 years, 8 months
JBoss Tools SVN: r7685 - trunk/struts/docs/struts_tools_tutorial/en.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-04-22 10:06:42 -0400 (Tue, 22 Apr 2008)
New Revision: 7685
Modified:
trunk/struts/docs/struts_tools_tutorial/en/master.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-261 - new chapters are organized during the restructuring the struts tutorial
Modified: trunk/struts/docs/struts_tools_tutorial/en/master.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/master.xml 2008-04-22 14:06:23 UTC (rev 7684)
+++ trunk/struts/docs/struts_tools_tutorial/en/master.xml 2008-04-22 14:06:42 UTC (rev 7685)
@@ -4,7 +4,11 @@
[<!ENTITY introduction SYSTEM "modules/introduction.xml">
<!ENTITY struts_application SYSTEM "modules/struts_application.xml">
+<!ENTITY generating_stub SYSTEM "modules/generating_stub.xml">
+<!ENTITY coding_files SYSTEM "modules/coding_files.xml">
+<!ENTITY compiling_and_running SYSTEM "modules/compiling_and_running.xml">
<!ENTITY struts_validation SYSTEM "modules/struts_validation.xml">
+<!ENTITY relevant_resources SYSTEM "modules/relevant_resources.xml">
]>
<book>
@@ -28,7 +32,11 @@
&introduction;
&struts_application;
+ &generating_stub;
+ &coding_files;
+ &compiling_and_running;
&struts_validation;
+ &relevant_resources;
</book>
17 years, 8 months
JBoss Tools SVN: r7684 - trunk/struts/docs/struts_tools_tutorial/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-04-22 10:06:23 -0400 (Tue, 22 Apr 2008)
New Revision: 7684
Added:
trunk/struts/docs/struts_tools_tutorial/en/modules/coding_files.xml
trunk/struts/docs/struts_tools_tutorial/en/modules/compiling_and_running.xml
trunk/struts/docs/struts_tools_tutorial/en/modules/generating_stub.xml
trunk/struts/docs/struts_tools_tutorial/en/modules/relevant_resources.xml
Modified:
trunk/struts/docs/struts_tools_tutorial/en/modules/introduction.xml
trunk/struts/docs/struts_tools_tutorial/en/modules/struts_application.xml
trunk/struts/docs/struts_tools_tutorial/en/modules/struts_validation.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-261 - new chapters are organized during the restructuring the struts tutorial
Added: trunk/struts/docs/struts_tools_tutorial/en/modules/coding_files.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/modules/coding_files.xml (rev 0)
+++ trunk/struts/docs/struts_tools_tutorial/en/modules/coding_files.xml 2008-04-22 14:06:23 UTC (rev 7684)
@@ -0,0 +1,436 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<chapter id="coding_files" xreflabel="coding_files">
+ <?dbhtml filename="coding_files.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>JBoss Tools</keyword>
+ <keyword>Struts</keyword>
+ <keyword>Struts Application</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>Coding the Various Files</title>
+ <para>We will now code both the Java stub classes just generated, the JSP files left in as
+ placeholders from previous steps, and a new start JSP page we will have to create.</para>
+ <section id="JavaStubClasses">
+ <title>Java Stub Classes</title>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>To finish the two Java classes, switch to the <emphasis>
+ <property>Package Explorer</property>
+ </emphasis> view and expand the <emphasis>
+ <property>JavaSource > sample</property>
+ </emphasis> folder</para>
+ </listitem>
+ </itemizedlist>
+ <section id="GetNameForm.java">
+ <title>GetNameForm.java</title>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Double-click <emphasis>
+ <property>GetNameForm.java</property>
+ </emphasis> for editing</para>
+ </listitem>
+
+ <listitem>
+ <para>You are looking at a Java stub class that was generated by JBoss
+ Developer Studio. Now we are going to edit the file</para>
+ </listitem>
+
+ <listitem>
+ <para>Add the following attributes at the beginning of the class:</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting role="JAVA"><![CDATA[private String name = "";
+ private String greetName = "";
+]]></programlisting>
+
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Inside the reset method, delete the TO DO and throw lines and
+ add:</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting role="JAVA"><![CDATA[this.name = "";
+ this.greetName = "";
+]]></programlisting>
+
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Inside the validate method, delete the TO DO and throw lines and
+ add:</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting role="JAVA"><![CDATA[ActionErrors errors = new ActionErrors();
+ return errors;
+]]></programlisting>
+
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Right-click and select <emphasis>
+ <property>Source > Generate Getters and Setters...</property>
+ </emphasis>from the context menu</para>
+ </listitem>
+ <listitem>
+ <para>In the dialog box, check the check boxes for name and greetName,
+ select First method for Insertion point, and click on the <emphasis>
+ <property>OK</property>
+ </emphasis> button</para>
+ </listitem>
+ </itemizedlist>
+ <para>The final GetNameForm.java file should look like this:</para>
+ <programlisting role="JAVA"><![CDATA[package sample;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionMapping;
+
+public class GetNameForm extends org.apache.struts.action.ActionForm
+{
+
+ private String name = "";
+ private String greetName = "";
+
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getGreetName()
+ {
+ return greetName;
+ }
+
+ public void setGreetName(String greetName)
+ {
+ this.greetName = greetName;
+ }
+
+ public GetNameForm()
+ {
+ }
+
+ public void reset(ActionMapping actionMapping, HttpServletRequest request)
+ {
+ this.name = "";
+ this.greetName = "";
+ }
+
+ public ActionErrors validate(ActionMapping actionMapping,
+ HttpServletRequest request)
+ {
+ ActionErrors errors = new ActionErrors();
+ return errors;
+ }
+}
+]]></programlisting>
+
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Save the file</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="GreetingAction.java">
+ <title>GreetingAction.java</title>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Open GreetingAction.java for editing</para>
+ </listitem>
+ <listitem>
+ <para>Inside the execute method, delete the TO DO lines and add the
+ following:</para>
+ </listitem>
+ </itemizedlist>
+
+ <programlisting role="JAVA"><![CDATA[String name = ((GetNameForm)form).getName();
+String greeting = "Hello, "+name+"!";
+((GetNameForm)form).setName(greeting);
+return mapping.findForward(FORWARD_sayHello);
+]]></programlisting>
+
+ <para>The final version of GreetingAction.java should look like this:</para>
+
+ <programlisting role="JAVA"><![CDATA[package sample;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+public class GreetingAction extends org.apache.struts.action.Action
+{
+
+ // Global Forwards
+ public static final String GLOBAL_FORWARD_getName = "getName";
+
+ // Local Forwards
+ public static final String FORWARD_sayHello = "sayHello";
+
+ public GreetingAction()
+ {
+ }
+ public ActionForward execute(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) throws Exception
+ {
+ String name = ((GetNameForm)form).getName();
+ String greeting = "Hello, "+name+"!";
+ ((GetNameForm)form).setName(greeting);
+ return mapping.findForward(FORWARD_sayHello);
+ }
+}
+]]></programlisting>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Save the file</para>
+ </listitem>
+ <listitem>
+ <para>Close the editors for the two Java files</para>
+ </listitem>
+ </itemizedlist>
+ <para>The last thing left to do is to code the JSP files whose editors should still
+ be open from having been created as placeholders.</para>
+ </section>
+ </section>
+ <section id="JSPPages">
+ <title>JSP Pages</title>
+ <section id="inputname.jsp">
+ <title>inputname.jsp</title>
+ <para>In this page, the user will enter any name and click the <emphasis>
+ <property>submit</property>
+ </emphasis> button. Then, the greeting action will be called through the form.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click on the <emphasis>
+ <property>inputname.jsp</property>
+ </emphasis> tab in the Editing area to bring its editor forward</para>
+ </listitem>
+ <listitem>
+ <para>In the Web Projects view, expand <emphasis>
+ <property>StrutsHello > Configuration > default
+ > struts-config.xml > action-mappings</property>
+ </emphasis> and select <emphasis>
+ <property>/greeting</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Drag it and drop it between the quotes for the <emphasis role="italic">
+ <property>"action"</property>
+ </emphasis> attribute to the <emphasis role="bold">
+ <property><html:form></property>
+ </emphasis> element in the Source pane of the editor</para>
+ </listitem>
+ <listitem>
+ <para>Then type this text on a new line just below this line:</para>
+ </listitem>
+
+ <programlisting role="XML"><![CDATA[Input name:
+]]></programlisting>
+
+ <listitem>
+ <para>Select the <emphasis>
+ <property>Visual</property>
+ </emphasis> pane of the editor</para>
+ </listitem>
+ <listitem>
+ <para>Then, in the JBoss Tools Palette, expand the <emphasis>
+ <property>Struts Form</property>
+ </emphasis> library, select <emphasis>
+ <property>text</property>
+ </emphasis>, and drag it onto the box <note>
+ <title>Note:</title>
+ <para>By default there are only four groups on the JBoss Tools
+ Palette. If you wish to make some group visible click the <emphasis>
+ <property>Show/Hide</property>
+ </emphasis> button on the top of palette and in the prompted
+ dialog check the group (or groups) you want to be shown.</para>
+ </note>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <figure>
+ <title>JBoss Tools Palette</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/struts_application/struts_application_3.png"
+ />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>In the Insert Tag dialog box, type in name for property and select <emphasis>
+ <property>Finish</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>In the StrutsForm library in the JBoss Tools Palette, select <emphasis>
+ <property>submit</property>
+ </emphasis>, and drag it to right after the text box in the Visual pane
+ of the editor</para>
+ </listitem>
+ <listitem>
+ <para>Right-click the <emphasis>
+ <property>submit</property>
+ </emphasis> button and select <emphasis role="bold">
+ <property><html:submit></property>
+ </emphasis> Attributes from the context menu</para>
+ </listitem>
+ <listitem>
+ <para>In the Attributes dialog box, select the <emphasis>
+ <property>value</property>
+ </emphasis> field and type in "Say Hello!" for its
+ value</para>
+ </listitem>
+ </itemizedlist>
+ <para>After tidying the page source, the Editor window for the file should look
+ something like this:</para>
+ <figure>
+ <title>Editor Window</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/struts_application/struts_application_4.png"
+ />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section id="greeting.jsp">
+ <title>greeting.jsp</title>
+ <para>Next, we will fill in the result page.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click on the <emphasis>
+ <property>greeting.jsp</property>
+ </emphasis> tab in the Editing area to bring its editor forward</para>
+ </listitem>
+ <listitem>
+ <para>Type in the following code:</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting role="XML"><![CDATA[<html>
+<head>
+ <title>Greeting</title>
+</head>
+ <body>
+ <p>
+ </p>
+ </body>
+</html>
+]]></programlisting>
+
+ <para>To complete editing of this file, we will use macros from the JBoss Tools
+ Palette. This palette is a view that should be available to the right of the
+ editing area.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click on the <emphasis>
+ <property>Struts Common</property>
+ </emphasis> folder in the JBoss Tools Palette to open it</para>
+ </listitem>
+ <listitem>
+ <para>Position the cursor at the beginning of the greeting.jsp file in the
+ Source pane and then click on bean taglib in the JBoss Tools
+ Palette</para>
+ </listitem>
+ </itemizedlist>
+ <para>This will insert the following line at the top of the file:</para>
+ <programlisting role="JAVA"><![CDATA[
+<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
+]]></programlisting>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click on the <emphasis>
+ <property>Struts Bean</property>
+ </emphasis> folder in the JBoss Tools Palette to open it</para>
+ </listitem>
+ <listitem>
+ <para>Position the cursor inside the <emphasis role="bold">
+ <property><p></property>
+ </emphasis> element</para>
+ </listitem>
+ <listitem>
+ <para>Click on write in the JBoss Tools Palette</para>
+ </listitem>
+ <listitem>
+ <para>Type in "GetNameForm" for the <emphasis
+ role="italic">
+ <property>"name"</property>
+ </emphasis> attribute and add a <emphasis role="italic">
+ <property>"property"</property>
+ </emphasis> attribute with "greetName" as its
+ value</para>
+ </listitem>
+ </itemizedlist>
+ <para>The editor should now look like this:</para>
+ <figure>
+ <title>Editor Window</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/struts_application/struts_application_5.png"
+ />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ <section id="index.jsp">
+ <title>index.jsp</title>
+ <para>Finally, we will need to create and edit an index.jsp page. This page will use
+ a Struts forward to simply redirect us to the getName global forward.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>In the Web Projects view, right-click on <emphasis>
+ <property>StrutsHello > WEB-ROOT(WebContent)</property>
+ </emphasis> node and select <emphasis>
+ <property>New > File > JSP..</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Type index for Name and click on the <emphasis>
+ <property>Finish</property>
+ </emphasis> button</para>
+ </listitem>
+ <listitem>
+ <para>On the JBoss Tools Palette, select the <emphasis>
+ <property>Struts Common</property>
+ </emphasis> folder of macros by clicking on it in the palette</para>
+ </listitem>
+ <listitem>
+ <para>Click on the logic taglib icon</para>
+ </listitem>
+ <listitem>
+ <para>Press the <emphasis>
+ <property>Enter</property>
+ </emphasis> key in the editor to go to the next line</para>
+ </listitem>
+ <listitem>
+ <para>Back on the palette, select the <emphasis>
+ <property>Struts Logic</property>
+ </emphasis> folder of macros</para>
+ </listitem>
+ <listitem>
+ <para>Click on redirect</para>
+ </listitem>
+ <listitem>
+ <para>Delete the ending tag, put a forward slash in front of the closing
+ angle bracket, and type "forward=getName" in front of
+ the slash</para>
+ </listitem>
+ </itemizedlist>
+ <para>The finished code for the page is shown below:</para>
+ <programlisting role="JAVA"><![CDATA[<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
+<logic:redirect forward="getName"/>
+]]></programlisting>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>To save all the edits to files, select <emphasis>
+ <property>File>Save All</property>
+ </emphasis> from the menu bar</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+ </chapter>
\ No newline at end of file
Added: trunk/struts/docs/struts_tools_tutorial/en/modules/compiling_and_running.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/modules/compiling_and_running.xml (rev 0)
+++ trunk/struts/docs/struts_tools_tutorial/en/modules/compiling_and_running.xml 2008-04-22 14:06:23 UTC (rev 7684)
@@ -0,0 +1,43 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<chapter id="compiling_and_running" xreflabel="compiling_and_running">
+ <?dbhtml filename="compiling_and_running.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>JBoss Tools</keyword>
+ <keyword>Struts</keyword>
+ <keyword>Struts Application</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>Compiling the Classes and Running the Application</title>
+
+ <para>As this is the Eclipse environment, no explicit compilation step is required. By
+ default, Eclipse compiles as you go.</para>
+
+ <para>Thus at this point everything is ready for running our application without having to leave JBoss
+ Developer Studio by using the JBoss Application Server engine that comes with the JBoss
+ Developer Studio. For controlling JBoss AS within JBoss Developer Studio, there is JBoss
+ Server view.</para>
+ <figure>
+ <title>JBoss Server Panel</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/struts_application/struts_application_6.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Start up JBoss AS by clicking on the icon in JBoss Server view. (If JBoss AS
+ is already running, stop it by clicking on the red icon and then start it again.
+ Remember, the Struts run-time requires restarting the servlet engine when any
+ changes have been made.)</para>
+ </listitem>
+ <listitem>
+ <para>After the messages in the Console tabbed view stop scrolling, JBoss AS is
+ available. At this point, right-click on the getName global forward in the
+ struts-config.xml diagram view and select Run on Server.</para>
+ </listitem>
+ </itemizedlist>
+ <para>The browser should appear with the application started.</para>
+ </chapter>
\ No newline at end of file
Added: trunk/struts/docs/struts_tools_tutorial/en/modules/generating_stub.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/modules/generating_stub.xml (rev 0)
+++ trunk/struts/docs/struts_tools_tutorial/en/modules/generating_stub.xml 2008-04-22 14:06:23 UTC (rev 7684)
@@ -0,0 +1,51 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<chapter id="generating_stub" xreflabel="generating_stub">
+ <?dbhtml filename="generating_stub.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>JBoss Tools</keyword>
+ <keyword>Struts</keyword>
+ <keyword>Struts Application</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>Generating Stub Coding</title>
+ <para>We are done with designing the application through the diagram. Now we need to write
+ code for the action component. We also need to write an action class for the <emphasis>
+ <property>/greeting</property>
+ </emphasis> mapping along with a FormBean. To aid in the coding phase, JBoss Developer
+ Studio can generate Java class stubs for all of the components shown in the diagram.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Switch back to the diagram, by selecting the <emphasis>
+ <property>Diagram</property>
+ </emphasis> tab at the bottom of the editor window</para>
+ </listitem>
+ <listitem>
+ <para>Right-click a blank space in the diagram and select <emphasis>
+ <property>Generate Java Code</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Leave everything as is in the dialog box and click <emphasis>
+ <property>Generate</property>
+ </emphasis></para>
+ </listitem>
+ </itemizedlist>
+ <para>You should see a screen that says:</para>
+ <para>Generated classes: 2</para>
+ <para>Actions: 1</para>
+ <para>Form beans: 1</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click <emphasis>
+ <property>Finish</property>
+ </emphasis></para>
+ </listitem>
+ </itemizedlist>
+ <para>The Java files will be generated in a <emphasis>
+ <property>JavaSource > sample</property>
+ </emphasis> folder that you can see in the Package Explorer view under the
+ "StrutsHello" node. One Action stub and one FormBean stub will have
+ been generated.</para>
+ </chapter>
\ No newline at end of file
Modified: trunk/struts/docs/struts_tools_tutorial/en/modules/introduction.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/modules/introduction.xml 2008-04-22 13:20:57 UTC (rev 7683)
+++ trunk/struts/docs/struts_tools_tutorial/en/modules/introduction.xml 2008-04-22 14:06:23 UTC (rev 7684)
@@ -3,7 +3,7 @@
<?dbhtml filename="introduction.html"?>
<chapterinfo>
<keywordset>
- <keyword>JBoss Developer Studio</keyword>
+ <keyword>JBoss Tools</keyword>
<keyword>Eclipse</keyword>
<keyword>Java</keyword>
<keyword>JBoss</keyword>
@@ -11,7 +11,16 @@
</chapterinfo>
<title>Introduction</title>
<para>The following chapters describe how to deal with classic/old style of Struts development. We
- recommend users to use <ulink url="../../seam/html_single/index.html">JBoss
- Seam</ulink> to simplify development, but until then you can read about classical Struts
- usage here.</para>
+ recommend users to use <ulink url="../../seam/html_single/index.html">JBoss Seam</ulink> to
+ simplify development, but until then you can read about classical Struts usage here.</para>
+
+ <para>We are going to show you how to create a simple <emphasis>
+ <property>Struts application</property>
+ </emphasis> using the JBoss Tools. The completed application will ask a user to enter
+ a name and click a button. The resulting new page will display the familiar message,
+ "Hello <name>!"</para>
+ <para>This document will show you how to create such an application from the beginning, along the
+ way demonstrating some of the powerful features of JBoss Tools. With the help of our tutorial you will design the
+ application, generate stub code for the application, fill in the stub coding, compile the
+ application, and finally run it all from inside the Eclipse.</para>
</chapter>
Added: trunk/struts/docs/struts_tools_tutorial/en/modules/relevant_resources.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/modules/relevant_resources.xml (rev 0)
+++ trunk/struts/docs/struts_tools_tutorial/en/modules/relevant_resources.xml 2008-04-22 14:06:23 UTC (rev 7684)
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<chapter id="relevant_resources" xreflabel="relevant_resources">
+ <?dbhtml filename="relevant_resources.html"?>
+ <chapterinfo>
+ <keywordset>
+ <keyword>JBoss Tools</keyword>
+ <keyword>Struts</keyword>
+ <keyword>Struts Application</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>Other Relevant Resources on the topic</title>
+
+ <para>Our reference: <ulink url="../../struts_tools_ref_guide/html_single/index.html">Struts Tools Reference Guide</ulink></para>
+ <para>Apache Struts: <ulink url="http://struts.apache.org/">Struts Technology</ulink></para>
+ <para>Struts 2: <ulink url="http://struts.apache.org/2.x/">Apache Struts 2</ulink></para>
+ <para>Get Started: <ulink url="http://struts.apache.org/2.x/docs/home.html">Struts Getting
+ Started</ulink></para>
+ <para>Struts on IBM: <ulink url="http://www.ibm.com/developerworks/library/j-struts/">Struts
+ - An open-source MVC implementation</ulink></para>
+ <para>FAQ: <ulink url="http://struts.apache.org/2.x/docs/faqs.html">Struts FAQ</ulink></para>
+ <para>Download: <ulink url="http://struts.apache.org/download.cgi#struts206">Release of
+ Apache Struts</ulink></para>
+ </chapter>
\ No newline at end of file
Modified: trunk/struts/docs/struts_tools_tutorial/en/modules/struts_application.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/modules/struts_application.xml 2008-04-22 13:20:57 UTC (rev 7683)
+++ trunk/struts/docs/struts_tools_tutorial/en/modules/struts_application.xml 2008-04-22 14:06:23 UTC (rev 7684)
@@ -1,512 +1,421 @@
<?xml version='1.0' encoding='UTF-8'?>
<chapter id="struts_application" xreflabel="struts_application">
<?dbhtml filename="struts_application.html"?>
- <title>Getting Started Guide for Creating a Struts Application</title>
- <para>We are going to show you how to create a simple <emphasis><property>Struts application</property></emphasis> using the JBoss Developer Studio. The completed application will ask a user to enter a name and click a button.
- The resulting new page will display the familiar message, "Hello <name>!"</para>
-<para>This document will show you how to create such an application from the beginning, along
-the way demonstrating some of the powerful features of JBoss Developer Studio. You will design the
-application, generate stub code for the application, fill in the stub coding, compile the application,
-and run the application all from inside JBoss Developer Studio.</para>
-<para>We assume that you have already launched Eclipse with JBoss Developer Studio installed and also that the Web Development perspective is the current perspective. (If not,
- make it active by selecting <emphasis><property>Window > Open Perspective > Other > Web Development</property></emphasis> from the menu bar.)</para>
-
+ <chapterinfo>
+ <keywordset>
+ <keyword>JBoss Tools</keyword>
+ <keyword>Struts</keyword>
+ <keyword>Struts Application</keyword>
+ </keywordset>
+ </chapterinfo>
+
+ <title>Creating a Simple Struts Application</title>
+
+ <para>Firstly, we assume that you have already launched Eclipse with JBoss Tools installed and
+ also that the <property>Web Development perspective</property> is the current perspective. (If not, make it
+ active by selecting <emphasis>
+ <property>Window > Open Perspective > Other > Web
+ Development</property>
+ </emphasis> from the menu bar.)</para>
+
<section id="StartingUp">
- <title>Starting Up</title>
-<para>We are first going to create a new project for the application.</para>
- <itemizedlist>
-<listitem><para>Go to the menu bar and select <emphasis><property>File > New > Project...</property></emphasis>.</para></listitem>
-<listitem><para>Select <emphasis><property>JBoss Tools Web > Struts > Struts Project</property></emphasis> in the New Project dialog box</para></listitem>
-<listitem><para>Click <emphasis><property>Next </property></emphasis></para></listitem>
-<listitem><para>Enter "StrutsHello" as the project name</para></listitem>
- <listitem><para>Leave everything else as is, and click <emphasis><property>Next</property></emphasis></para></listitem>
- <listitem><para>Click <emphasis><property>Next</property></emphasis> again</para></listitem>
- <listitem><para>Make sure that <emphasis><property>struts-bean.tld</property></emphasis>, <emphasis><property>struts-html.tld</property></emphasis>, and <emphasis><property>struts-logic.tld</property></emphasis> are checked in the list of included tag libraries and then click <emphasis><property>Finish</property></emphasis></para></listitem>
-</itemizedlist>
-<para>A "StrutsHello" node should appear in the upper-left Package Explorer view.</para>
- <itemizedlist continuation="continues">
- <listitem><para>Click the plus sign next to <emphasis><property>StrutsHello</property></emphasis> to reveal the child nodes</para></listitem>
- <listitem><para>Click the plus sign next to <emphasis><property>WebContent</property></emphasis> under StrutsHello</para></listitem>
- <listitem><para>Click the plus sign next to <emphasis><property>WEB-INF</property></emphasis> under WebContent</para></listitem>
- <listitem><para>Then, double-click on the <emphasis><property>struts-config.xml</property></emphasis> node to display a diagram of the Struts application configuration file in the editing area</para></listitem>
- </itemizedlist>
-<para>At this point, its empty except for the background grid lines.</para>
+ <title>Starting Up</title>
+ <para>We are first going to create a new project for the application.</para>
+ <itemizedlist>
+ <listitem>
+ <para>Go to the menu bar and select <emphasis>
+ <property>File > New > Project...</property>
+ </emphasis>.</para>
+ </listitem>
+ <listitem>
+ <para>Select <emphasis>
+ <property>JBoss Tools Web > Struts > Struts Project</property>
+ </emphasis> in the New Project dialog box</para>
+ </listitem>
+ <listitem>
+ <para>Click <emphasis>
+ <property>Next </property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Enter "StrutsHello" as the project name</para>
+ </listitem>
+ <listitem>
+ <para>Leave everything else as is, and click <emphasis>
+ <property>Next</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Click <emphasis>
+ <property>Next</property>
+ </emphasis> again</para>
+ </listitem>
+ <listitem>
+ <para>Make sure that <emphasis>
+ <property>struts-bean.tld</property>
+ </emphasis>, <emphasis>
+ <property>struts-html.tld</property>
+ </emphasis>, and <emphasis>
+ <property>struts-logic.tld</property>
+ </emphasis> are checked in the list of included tag libraries and then click <emphasis>
+ <property>Finish</property>
+ </emphasis></para>
+ </listitem>
+ </itemizedlist>
+ <para>A "StrutsHello" node should appear in the upper-left Package
+ Explorer view.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click the plus sign next to <emphasis>
+ <property>StrutsHello</property>
+ </emphasis> to reveal the child nodes</para>
+ </listitem>
+ <listitem>
+ <para>Click the plus sign next to <emphasis>
+ <property>WebContent</property>
+ </emphasis> under StrutsHello</para>
+ </listitem>
+ <listitem>
+ <para>Click the plus sign next to <emphasis>
+ <property>WEB-INF</property>
+ </emphasis> under WebContent</para>
+ </listitem>
+ <listitem>
+ <para>Then, double-click on the <emphasis>
+ <property>struts-config.xml</property>
+ </emphasis> node to display a diagram of the Struts application configuration
+ file in the editing area</para>
+ </listitem>
+ </itemizedlist>
+ <para>At this point, its empty except for the background grid lines.</para>
</section>
-
+
<section id="CreatingtheApplicationComponents">
<?dbhtml filename="CreatingtheApplicationComponents.html"?>
<title>Creating the Application Components</title>
-<para>Now, we will design the application by creating the individual components as placeholders
-first. (We dont have to complete all of the details inside the components until afterwards.)</para>
+ <para>Now, we will design the application by creating the individual components as
+ placeholders first. (We dont have to complete all of the details inside the components
+ until afterwards.)</para>
<section id="CreatingJSPPagePlaceholders">
- <title>Creating JSP Page Placeholders</title>
- <para>Next, let's create and place two JSP pages. We will not write any code for the files, but only
-create them as placeholders so that we can create links to them in the diagram. We will write
-the code a little bit later.</para>
+ <title>Creating JSP Page Placeholders</title>
+ <para>Next, let's create and place two JSP pages. We will not write any code
+ for the files, but only create them as placeholders so that we can create links to
+ them in the diagram. We will write the code a little bit later.</para>
<section id="CreatingthePagePlaceholders">
- <title>Creating the Page Placeholders</title>
- <itemizedlist continuation="continues">
- <listitem><para>Bring the Web Projects view to the front of the Package Explorer view by selecting the <emphasis><property>Web Projects</property></emphasis> tab next to that tab.</para></listitem>
- <listitem><para>Right-click the <emphasis><property>StrutsHello > WEB-ROOT (WebContent)</property></emphasis> folder in the Web Projects view and select <emphasis><property>New > Folder...</property></emphasis></para></listitem>
- <listitem><para>Enter <emphasis><property>pages</property></emphasis> for a folder name and click <emphasis><property>Finish</property></emphasis></para></listitem>
-
-<listitem><para>We will keep our presentation files in this folder</para></listitem>
+ <title>Creating the Page Placeholders</title>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Bring the Web Projects view to the front of the Package Explorer view
+ by selecting the <emphasis>
+ <property>Web Projects</property>
+ </emphasis> tab next to that tab.</para>
+ </listitem>
+ <listitem>
+ <para>Right-click the <emphasis>
+ <property>StrutsHello > WEB-ROOT (WebContent)</property>
+ </emphasis> folder in the Web Projects view and select <emphasis>
+ <property>New > Folder...</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Enter <emphasis>
+ <property>pages</property>
+ </emphasis> for a folder name and click <emphasis>
+ <property>Finish</property>
+ </emphasis></para>
+ </listitem>
-<listitem><para>Right-click the pages folder and select <emphasis><property>New > Fila > JSP...</property></emphasis> </para></listitem>
- <listitem><para>For Name type in <emphasis><property>inputname</property></emphasis> (the JSP extension will be automatically added to the file), for Template select <emphasis><property>StrutsForm</property></emphasis> and then click on the <emphasis><property>Finish</property></emphasis> button</para></listitem>
-<listitem><para>Right-click the pages folder again and select <emphasis><property>New > File > JSP...</property></emphasis></para></listitem>
- <listitem><para>For Name type in <emphasis><property>greeting</property></emphasis>, for Template leave as Blank, and then click on the <emphasis><property>Finish</property></emphasis> button</para></listitem>
- </itemizedlist>
-<para>Just leave these files as is for now.</para>
- </section>
+ <listitem>
+ <para>We will keep our presentation files in this folder</para>
+ </listitem>
+
+ <listitem>
+ <para>Right-click the pages folder and select <emphasis>
+ <property>New > Fila > JSP...</property>
+ </emphasis>
+ </para>
+ </listitem>
+ <listitem>
+ <para>For Name type in <emphasis>
+ <property>inputname</property>
+ </emphasis> (the JSP extension will be automatically added to the file),
+ for Template select <emphasis>
+ <property>StrutsForm</property>
+ </emphasis> and then click on the <emphasis>
+ <property>Finish</property>
+ </emphasis> button</para>
+ </listitem>
+ <listitem>
+ <para>Right-click the pages folder again and select <emphasis>
+ <property>New > File > JSP...</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>For Name type in <emphasis>
+ <property>greeting</property>
+ </emphasis>, for Template leave as Blank, and then click on the <emphasis>
+ <property>Finish</property>
+ </emphasis> button</para>
+ </listitem>
+ </itemizedlist>
+ <para>Just leave these files as is for now.</para>
+ </section>
<section id="PlacingthePagePlaceholders">
- <title>Placing the Page Placeholders</title>
-<para>Lets now place the two pages just created on the diagram.</para>
- <itemizedlist continuation="continues">
- <listitem><para>Click on the <emphasis><property>struts-config.xml</property></emphasis> tab in the Editing area to bring the diagram to the front</para></listitem>
- <listitem><para>Click on the <emphasis><property>inputname.jsp</property></emphasis> page in the Web Projects view, drag it onto the diagram, and drop it</para></listitem>
- <listitem>Click on the <emphasis><property>greeting.jsp</property></emphasis> page in the Web Projects view, drag it onto the diagram,
-and drop it to the right of the <emphasis><property>/pages/inputname.jsp</property></emphasis> icon with some extra space</listitem>
-</itemizedlist>
-<para>You should now have two JSP pages in the diagram.</para>
- </section>
- </section>
+ <title>Placing the Page Placeholders</title>
+ <para>Lets now place the two pages just created on the diagram.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click on the <emphasis>
+ <property>struts-config.xml</property>
+ </emphasis> tab in the Editing area to bring the diagram to the
+ front</para>
+ </listitem>
+ <listitem>
+ <para>Click on the <emphasis>
+ <property>inputname.jsp</property>
+ </emphasis> page in the Web Projects view, drag it onto the diagram, and
+ drop it</para>
+ </listitem>
+ <listitem>Click on the <emphasis>
+ <property>greeting.jsp</property>
+ </emphasis> page in the Web Projects view, drag it onto the diagram, and
+ drop it to the right of the <emphasis>
+ <property>/pages/inputname.jsp</property>
+ </emphasis> icon with some extra space</listitem>
+ </itemizedlist>
+ <para>You should now have two JSP pages in the diagram.</para>
+ </section>
+ </section>
<section id="CreatinganActionMappings">
- <title>Creating an Action Mappings</title>
-<para>Using a context menu on the diagram, we are next going to create an Action mapping.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Right-click between the two icons and select <emphasis><property>Add > Action</property></emphasis></para></listitem>
-<listitem><para>Enter the following values:</para></listitem>
- </itemizedlist>
- <table>
- <tgroup cols="2">
- <tbody>
- <row>
- <entry>path</entry>
- <entry>/greeting</entry>
- </row>
- <row>
- <entry>name</entry>
- <entry>GetNameForm</entry>
- </row>
- <row>
- <entry>scope</entry>
- <entry>request</entry>
- </row>
- <row>
- <entry>type</entry>
- <entry>sample.GreetingAction</entry>
- </row>
- <row>
- <entry>validate</entry>
- <entry><leave blank></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-<para>("GetNameForm" is the name for a form bean that we will create later.)</para>
-<itemizedlist continuation="continues">
- <listitem><para>Click <emphasis><property>Finish</property></emphasis></para></listitem>
-</itemizedlist>
-
-<para>The <emphasis><property>/greeting</property></emphasis> action should appear in four places, in the diagram, under the action-mappings node, under the struts-config.xml node in Tree view, in Web Projects view and in the Outline view. Also, note the asterisk to the right of the name, struts-config.xml, in the Outline view showing that the file has been changed, but not saved to disk.</para>
- </section>
+ <title>Creating an Action Mappings</title>
+ <para>Using a context menu on the diagram, we are next going to create an Action
+ mapping.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Right-click between the two icons and select <emphasis>
+ <property>Add > Action</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Enter the following values:</para>
+ </listitem>
+ </itemizedlist>
+ <table>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>path</entry>
+ <entry>/greeting</entry>
+ </row>
+ <row>
+ <entry>name</entry>
+ <entry>GetNameForm</entry>
+ </row>
+ <row>
+ <entry>scope</entry>
+ <entry>request</entry>
+ </row>
+ <row>
+ <entry>type</entry>
+ <entry>sample.GreetingAction</entry>
+ </row>
+ <row>
+ <entry>validate</entry>
+ <entry><leave blank></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>("GetNameForm" is the name for a form bean that we will create
+ later.)</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Click <emphasis>
+ <property>Finish</property>
+ </emphasis></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The <emphasis>
+ <property>/greeting</property>
+ </emphasis> action should appear in four places, in the diagram, under the
+ action-mappings node, under the struts-config.xml node in Tree view, in Web Projects
+ view and in the Outline view. Also, note the asterisk to the right of the name,
+ struts-config.xml, in the Outline view showing that the file has been changed, but
+ not saved to disk.</para>
+ </section>
<section id="CreatingaLink">
- <title>Creating a Link</title>
-<para>Let's now create a link from the inputname.jsp page to the action.</para>
- <itemizedlist continuation="continues">
-<listitem><para>On the left-hand side of the diagram in the column of icons, click on this icon:</para></listitem>
- </itemizedlist>
+ <title>Creating a Link</title>
+ <para>Let's now create a link from the inputname.jsp page to the action.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>On the left-hand side of the diagram in the column of icons, click on this
+ icon:</para>
+ </listitem>
+ </itemizedlist>
<figure>
<title>Create New Connection Icon</title>
- <mediaobject>
+ <mediaobject>
<imageobject>
<imagedata fileref="images/struts_application/struts_application_1.png"/>
</imageobject>
</mediaobject>
- </figure>
+ </figure>
<itemizedlist continuation="continues">
- <listitem><para>In the connect-the-components mode you are in now, click on the <emphasis><property>/pages/inputname.jsp</property></emphasis> icon in the diagram and then click on the <emphasis><property>/greeting</property></emphasis> action</para></listitem>
- </itemizedlist>
-<para>A link will be created from the page to the action.</para>
- </section>
+ <listitem>
+ <para>In the connect-the-components mode you are in now, click on the <emphasis>
+ <property>/pages/inputname.jsp</property>
+ </emphasis> icon in the diagram and then click on the <emphasis>
+ <property>/greeting</property>
+ </emphasis> action</para>
+ </listitem>
+ </itemizedlist>
+ <para>A link will be created from the page to the action.</para>
+ </section>
<section id="CreatingaForward">
- <title>Creating a Forward</title>
-<para>Next, we are going to create a forward for the action.</para>
- <itemizedlist continuation="continues">
-<listitem><para>On the left-hand side of the diagram in the column of icons, click on this icon, again:</para></listitem>
- </itemizedlist>
+ <title>Creating a Forward</title>
+ <para>Next, we are going to create a forward for the action.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>On the left-hand side of the diagram in the column of icons, click on this
+ icon, again:</para>
+ </listitem>
+ </itemizedlist>
<figure>
<title>Create New Connection Icon</title>
- <mediaobject>
+ <mediaobject>
<imageobject>
<imagedata fileref="images/struts_application/struts_application_1.png"/>
</imageobject>
</mediaobject>
</figure>
- <itemizedlist continuation="continues">>
-<listitem><para>Click on the <emphasis><property>/greeting</property></emphasis> action icon in the diagram and then click on the <emphasis><property>pages/greeting.jsp</property></emphasis> icon</para></listitem>
-
-<listitem><para>That's it. A link will be drawn from the actions new greeting forward to the greeting.jsp JSP page. Note that the forwards name will be set based on the name of the target JSP file name. If you don't like it, you can easily change it</para></listitem>
-
- <listitem><para>Select the <emphasis><property>Tree</property></emphasis> tab at the bottom of the editor window (between Diagram and Source)</para></listitem>
-<listitem><para>Expand the <emphasis><property>struts-config.xml/action-mappings//greeting</property></emphasis> node and then select the greeting forward</para></listitem>
-<listitem><para>In the Properties Editor to the right, change the text to "sayHello" in the Name field</para></listitem>
- <listitem><para>Select the <emphasis><property>Diagram</property></emphasis> tab at the bottom of the editor window and see how the diagram is also updated to reflect the change</para></listitem>
- </itemizedlist>
- </section>
+ <itemizedlist continuation="continues">> <listitem>
+ <para>Click on the <emphasis>
+ <property>/greeting</property>
+ </emphasis> action icon in the diagram and then click on the <emphasis>
+ <property>pages/greeting.jsp</property>
+ </emphasis> icon</para>
+ </listitem>
+ <listitem>
+ <para>That's it. A link will be drawn from the actions new greeting
+ forward to the greeting.jsp JSP page. Note that the forwards name will be
+ set based on the name of the target JSP file name. If you don't
+ like it, you can easily change it</para>
+ </listitem>
+ <listitem>
+ <para>Select the <emphasis>
+ <property>Tree</property>
+ </emphasis> tab at the bottom of the editor window (between Diagram and
+ Source)</para>
+ </listitem>
+ <listitem>
+ <para>Expand the <emphasis>
+ <property>struts-config.xml/action-mappings//greeting</property>
+ </emphasis> node and then select the greeting forward</para>
+ </listitem>
+ <listitem>
+ <para>In the Properties Editor to the right, change the text to
+ "sayHello" in the Name field</para>
+ </listitem>
+ <listitem>
+ <para>Select the <emphasis>
+ <property>Diagram</property>
+ </emphasis> tab at the bottom of the editor window and see how the diagram
+ is also updated to reflect the change</para>
+ </listitem>
+ </itemizedlist>
+ </section>
<section id="CreatingaGlobalForward">
- <title>Creating a Global Forward</title>
-<para>One last component that we need to create in the diagram is a global forward.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Somewhere in the top-left corner of diagram, right-click and select <emphasis><property> Add > Global Forward...</property></emphasis></para></listitem>
- <listitem><para>Enter <emphasis><property>getName</property></emphasis> in the Name field</para></listitem>
-<listitem><para>Select the <emphasis><property>Change...</property></emphasis>button for Path</para></listitem>
- <listitem><para>In the Edit Path window, switch to the <emphasis><property>Pages</property></emphasis> tab</para></listitem>
-<listitem><para>Expand the <emphasis><property>StrutsHello > WEB-ROOT (WebContent) > pages</property></emphasis> node and then select the inputname.jsp page</para></listitem>
-<listitem><para>Click <emphasis><property>Ok</property></emphasis>.</para></listitem>
-<listitem><para>Leave the rest of the fields blank and click <emphasis><property>OK</property></emphasis></para></listitem>
- </itemizedlist>
-<para>A forward object now appears on the diagram and also in the global-forwards folder in the Outline view.</para>
- <itemizedlist continuation="continues">
- <listitem><para>Tidy up the diagram, by clicking and dragging around each icon, so that the diagram looks something like this:</para></listitem>
- </itemizedlist>
+ <title>Creating a Global Forward</title>
+ <para>One last component that we need to create in the diagram is a global forward.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Somewhere in the top-left corner of diagram, right-click and select <emphasis>
+ <property> Add > Global Forward...</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>Enter <emphasis>
+ <property>getName</property>
+ </emphasis> in the Name field</para>
+ </listitem>
+ <listitem>
+ <para>Select the <emphasis>
+ <property>Change...</property>
+ </emphasis>button for Path</para>
+ </listitem>
+ <listitem>
+ <para>In the Edit Path window, switch to the <emphasis>
+ <property>Pages</property>
+ </emphasis> tab</para>
+ </listitem>
+ <listitem>
+ <para>Expand the <emphasis>
+ <property>StrutsHello > WEB-ROOT (WebContent) > pages</property>
+ </emphasis> node and then select the inputname.jsp page</para>
+ </listitem>
+ <listitem>
+ <para>Click <emphasis>
+ <property>Ok</property>
+ </emphasis>.</para>
+ </listitem>
+ <listitem>
+ <para>Leave the rest of the fields blank and click <emphasis>
+ <property>OK</property>
+ </emphasis></para>
+ </listitem>
+ </itemizedlist>
+ <para>A forward object now appears on the diagram and also in the global-forwards folder
+ in the Outline view.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Tidy up the diagram, by clicking and dragging around each icon, so that
+ the diagram looks something like this:</para>
+ </listitem>
+ </itemizedlist>
<figure>
<title>Diagram View</title>
- <mediaobject>
+ <mediaobject>
<imageobject>
<imagedata fileref="images/struts_application/struts_application_2.png"/>
</imageobject>
</mediaobject>
</figure>
- </section>
+ </section>
<section id="CreatingaFormBean">
- <title>Creating a Form Bean</title>
-<para>One last thing that we need to do is to create a form bean.</para>
- <itemizedlist continuation="continues">
- <listitem><para>Switch to the Tree viewer in the editor for the struts-config.xml file, by selecting the <emphasis><property>Tree</property></emphasis> tab at the bottom of the editor window</para></listitem>
-<listitem><para>Right-click <emphasis><property>struts-config.xml > form-beans</property></emphasis> and select Create Form Bean</para></listitem>
- <listitem><para>Enter <emphasis><property>GetNameForm</property></emphasis> in the name field and <emphasis><property>sample.GetNameForm</property></emphasis> for type</para></listitem>
- <listitem><para>Click <emphasis><property>Finish</property></emphasis></para></listitem>
-<listitem><para>To save your changes to struts-config.xml, select <emphasis><property>File > Save</property></emphasis> from the menu bar</para></listitem>
- </itemizedlist>
-<para>Note the disappearance of the asterisk next to the name, struts-config.xml.</para>
-</section>
-</section>
-
- <section id="GeneratingStubCoding">
- <?dbhtml filename="GeneratingStubCoding.html"?>
- <title>Generating Stub Coding</title>
- <para>We are done with designing the application through the diagram. Now we need to write
- code for the action component. We also need to write an action class for the <emphasis><property>/greeting</property></emphasis> mapping
- along with a FormBean. To aid in the coding phase, JBoss Developer Studio can generate Java class
- stubs for all of the components shown in the diagram.</para>
- <itemizedlist continuation="continues">
- <listitem><para>Switch back to the diagram, by selecting the <emphasis><property>Diagram</property></emphasis> tab at the bottom of the editor window</para></listitem>
- <listitem><para>Right-click a blank space in the diagram and select <emphasis><property>Generate Java Code</property></emphasis></para></listitem>
- <listitem><para>Leave everything as is in the dialog box and click <emphasis><property>Generate</property></emphasis></para></listitem>
-</itemizedlist>
-<para>You should see a screen that says:</para>
-<para>Generated classes: 2</para>
-<para>Actions: 1</para>
-<para>Form beans: 1</para>
- <itemizedlist continuation="continues">
- <listitem><para>Click <emphasis><property>Finish</property></emphasis></para></listitem>
- </itemizedlist>
-<para>The Java files will be generated in a <emphasis><property>JavaSource > sample</property></emphasis> folder that you can see in the Package Explorer view under the "StrutsHello" node. One Action stub and one FormBean stub will have been generated.</para>
- </section>
- <section id="CodingtheVariousFiles">
- <?dbhtml filename="CodingtheVariousFiles.html"?>
- <title>Coding the Various Files</title>
-<para>We will now code both the Java stub classes just generated, the JSP files left in as placeholders
- from previous steps, and a new start JSP page we will have to create.</para>
- <section id="JavaStubClasses">
- <title>Java Stub Classes</title>
- <itemizedlist continuation="continues">
- <listitem><para>To finish the two Java classes, switch to the <emphasis><property>Package Explorer</property></emphasis> view and expand the <emphasis><property>JavaSource > sample</property></emphasis> folder</para></listitem>
- </itemizedlist>
- <section id="GetNameForm.java">
- <title>GetNameForm.java</title>
- <itemizedlist continuation="continues">
- <listitem><para>Double-click <emphasis><property>GetNameForm.java</property></emphasis> for editing</para></listitem>
-
-<listitem><para>You are looking at a Java stub class that was generated by JBoss Developer Studio. Now we are going to edit the file</para></listitem>
-
-<listitem><para>Add the following attributes at the beginning of the class:</para></listitem>
- </itemizedlist>
- <programlisting role="JAVA"><![CDATA[private String name = "";
- private String greetName = "";
-]]></programlisting>
-
- <itemizedlist continuation="continues">
-<listitem><para>Inside the reset method, delete the TO DO and throw lines and add:</para></listitem>
-</itemizedlist>
-<programlisting role="JAVA"><![CDATA[this.name = "";
- this.greetName = "";
-]]></programlisting>
-
- <itemizedlist continuation="continues">
-<listitem><para>Inside the validate method, delete the TO DO and throw lines and add:</para></listitem>
- </itemizedlist>
- <programlisting role="JAVA"><![CDATA[ActionErrors errors = new ActionErrors();
- return errors;
-]]></programlisting>
-
- <itemizedlist continuation="continues">
-<listitem><para>Right-click and select <emphasis><property>Source > Generate Getters and Setters...</property></emphasis>from the context menu</para></listitem>
- <listitem><para>In the dialog box, check the check boxes for name and greetName, select First method for Insertion point, and click on the <emphasis><property>OK</property></emphasis> button</para></listitem>
- </itemizedlist>
-<para>The final GetNameForm.java file should look like this:</para>
-<programlisting role="JAVA"><![CDATA[package sample;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.struts.action.ActionErrors;
-import org.apache.struts.action.ActionMapping;
-
-public class GetNameForm extends org.apache.struts.action.ActionForm
-{
-
- private String name = "";
- private String greetName = "";
-
- public String getName()
- {
- return name;
- }
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getGreetName()
- {
- return greetName;
- }
-
- public void setGreetName(String greetName)
- {
- this.greetName = greetName;
- }
-
- public GetNameForm()
- {
- }
-
- public void reset(ActionMapping actionMapping, HttpServletRequest request)
- {
- this.name = "";
- this.greetName = "";
- }
-
- public ActionErrors validate(ActionMapping actionMapping,
- HttpServletRequest request)
- {
- ActionErrors errors = new ActionErrors();
- return errors;
- }
-}
-]]></programlisting>
-
-<itemizedlist continuation="continues">
-<listitem><para>Save the file</para></listitem>
-</itemizedlist>
-</section>
- <section id="GreetingAction.java">
- <title>GreetingAction.java</title>
- <itemizedlist continuation="continues">
-<listitem><para>Open GreetingAction.java for editing</para></listitem>
-<listitem><para>Inside the execute method, delete the TO DO lines and add the following:</para></listitem>
- </itemizedlist>
-
- <programlisting role="JAVA"><![CDATA[String name = ((GetNameForm)form).getName();
-String greeting = "Hello, "+name+"!";
-((GetNameForm)form).setName(greeting);
-return mapping.findForward(FORWARD_sayHello);
-]]></programlisting>
-
-<para>The final version of GreetingAction.java should look like this:</para>
-
-<programlisting role="JAVA"><![CDATA[package sample;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-
-public class GreetingAction extends org.apache.struts.action.Action
-{
-
- // Global Forwards
- public static final String GLOBAL_FORWARD_getName = "getName";
-
- // Local Forwards
- public static final String FORWARD_sayHello = "sayHello";
-
- public GreetingAction()
- {
- }
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response) throws Exception
- {
- String name = ((GetNameForm)form).getName();
- String greeting = "Hello, "+name+"!";
- ((GetNameForm)form).setName(greeting);
- return mapping.findForward(FORWARD_sayHello);
- }
-}
-]]></programlisting>
- <itemizedlist continuation="continues">
-<listitem><para>Save the file</para></listitem>
-<listitem><para>Close the editors for the two Java files</para></listitem>
- </itemizedlist>
-<para>The last thing left to do is to code the JSP files whose editors should still be open from having been created as placeholders.</para>
- </section>
- </section>
- <section id="JSPPages">
- <title>JSP Pages</title>
- <section id="inputname.jsp">
- <title>inputname.jsp</title>
- <para>In this page, the user will enter any name and click the <emphasis><property>submit</property></emphasis> button. Then, the greeting action will be called through the form.</para>
- <itemizedlist continuation="continues">
- <listitem><para>Click on the <emphasis><property>inputname.jsp</property></emphasis> tab in the Editing area to bring its editor forward</para></listitem>
-<listitem><para>In the Web Projects view, expand <emphasis><property>StrutsHello > Configuration > default > struts-config.xml > action-mappings</property></emphasis> and select <emphasis><property>/greeting</property></emphasis></para></listitem>
-<listitem><para>Drag it and drop it between the quotes for the <emphasis role="italic"><property>"action"</property></emphasis> attribute to the <emphasis role="bold"><property><html:form></property></emphasis> element in the Source pane of the editor</para></listitem>
-<listitem><para>Then type this text on a new line just below this line:</para></listitem>
-
-<programlisting role="XML"><![CDATA[Input name:
-]]></programlisting>
-
- <listitem><para>Select the <emphasis><property>Visual</property></emphasis> pane of the editor</para></listitem>
- <listitem><para>Then, in the JBoss Tools Palette, expand the <emphasis><property>Struts Form</property></emphasis> library, select <emphasis><property>text</property></emphasis>, and drag it onto the box
- <note>
- <title>Note:</title>
- <para>By default there are only four groups on the JBoss Tools Palette. If you wish to make some group visible click the <emphasis><property>Show/Hide</property></emphasis> button on the top of palette and in the prompted dialog check the group (or groups) you want to be shown.</para>
- </note>
- </para></listitem>
- </itemizedlist>
- <figure>
- <title>JBoss Tools Palette</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/struts_application/struts_application_3.png" />
- </imageobject>
- </mediaobject>
- </figure>
- <itemizedlist continuation="continues">
- <listitem><para>In the Insert Tag dialog box, type in name for property and select <emphasis><property>Finish</property></emphasis></para></listitem>
- <listitem><para>In the StrutsForm library in the JBoss Tools Palette, select <emphasis><property>submit</property></emphasis>, and drag it to right after the text box in the Visual pane of the editor</para></listitem>
- <listitem><para>Right-click the <emphasis><property>submit</property></emphasis> button and select <emphasis role="bold"><property><html:submit></property></emphasis> Attributes from the context menu</para></listitem>
- <listitem><para>In the Attributes dialog box, select the <emphasis><property>value</property></emphasis> field and type in "Say Hello!" for its value</para></listitem>
- </itemizedlist>
-<para>After tidying the page source, the Editor window for the file should look something like this:</para>
- <figure>
- <title>Editor Window</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/struts_application/struts_application_4.png" />
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="greeting.jsp">
- <title>greeting.jsp</title>
-<para>Next, we will fill in the result page.</para>
-<itemizedlist continuation="continues">
- <listitem><para>Click on the <emphasis><property>greeting.jsp</property></emphasis> tab in the Editing area to bring its editor forward</para></listitem>
-<listitem><para>Type in the following code:</para></listitem>
- </itemizedlist>
-<programlisting role="XML"><![CDATA[<html>
-<head>
- <title>Greeting</title>
-</head>
- <body>
- <p>
- </p>
- </body>
-</html>
-]]></programlisting>
-
-<para>To complete editing of this file, we will use macros from the JBoss Tools Palette. This palette is a view that should be available to the right of the editing area.</para>
- <itemizedlist continuation="continues">
-<listitem><para>Click on the <emphasis><property>Struts Common</property></emphasis> folder in the JBoss Tools Palette to open it</para></listitem>
-<listitem><para>Position the cursor at the beginning of the greeting.jsp file in the Source pane and then click on bean taglib in the JBoss Tools Palette</para></listitem>
-</itemizedlist>
-<para>This will insert the following line at the top of the file:</para>
-<programlisting role="JAVA"><![CDATA[
-<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
-]]></programlisting>
-<itemizedlist continuation="continues">
- <listitem><para>Click on the <emphasis><property>Struts Bean</property></emphasis> folder in the JBoss Tools Palette to open it</para></listitem>
-<listitem><para>Position the cursor inside the <emphasis role="bold"><property><p></property></emphasis> element</para></listitem>
-<listitem><para>Click on write in the JBoss Tools Palette</para></listitem>
-<listitem><para>Type in "GetNameForm" for the <emphasis role="italic"><property>"name"</property></emphasis> attribute and add a <emphasis role="italic"><property>"property"</property></emphasis> attribute with "greetName" as its value</para></listitem>
- </itemizedlist>
-<para>The editor should now look like this:</para>
- <figure>
- <title>Editor Window</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/struts_application/struts_application_5.png" />
- </imageobject>
- </mediaobject>
- </figure>
- </section>
- <section id="index.jsp">
- <title>index.jsp</title>
-<para>Finally, we will need to create and edit an index.jsp page. This page will use a Struts forward to simply redirect us to the getName global forward.</para>
- <itemizedlist continuation="continues">
-<listitem><para>In the Web Projects view, right-click on <emphasis><property>StrutsHello > WEB-ROOT(WebContent)</property></emphasis> node and select <emphasis><property>New > File > JSP..</property></emphasis></para></listitem>
- <listitem><para>Type index for Name and click on the <emphasis><property>Finish</property></emphasis> button</para></listitem>
- <listitem><para>On the JBoss Tools Palette, select the <emphasis><property>Struts Common</property></emphasis> folder of macros by clicking on it in the palette</para></listitem>
-<listitem><para>Click on the logic taglib icon</para></listitem>
- <listitem><para>Press the <emphasis><property>Enter</property></emphasis> key in the editor to go to the next line</para></listitem>
- <listitem><para>Back on the palette, select the <emphasis><property>Struts Logic</property></emphasis> folder of macros</para></listitem>
-<listitem><para>Click on redirect</para></listitem>
-<listitem><para>Delete the ending tag, put a forward slash in front of the closing angle bracket, and type "forward=getName" in front of the slash</para></listitem>
- </itemizedlist>
-<para>The finished code for the page is shown below:</para>
-<programlisting role="JAVA"><![CDATA[<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
-<logic:redirect forward="getName"/>
-]]></programlisting>
- <itemizedlist continuation="continues">
-<listitem><para>To save all the edits to files, select <emphasis><property>File>Save All</property></emphasis> from the menu bar</para></listitem>
- </itemizedlist>
- </section>
- </section>
- </section>
- <section id="CompilingtheClasses">
- <?dbhtml filename="CompilingtheClasses.html"?>
- <title>Compiling the Classes</title>
- <para>Because this is the Eclipse environment, no explicit compilation step is required. By default, Eclipse compiles as you go.</para>
+ <title>Creating a Form Bean</title>
+ <para>One last thing that we need to do is to create a form bean.</para>
+ <itemizedlist continuation="continues">
+ <listitem>
+ <para>Switch to the Tree viewer in the editor for the struts-config.xml file, by
+ selecting the <emphasis>
+ <property>Tree</property>
+ </emphasis> tab at the bottom of the editor window</para>
+ </listitem>
+ <listitem>
+ <para>Right-click <emphasis>
+ <property>struts-config.xml > form-beans</property>
+ </emphasis> and select Create Form Bean</para>
+ </listitem>
+ <listitem>
+ <para>Enter <emphasis>
+ <property>GetNameForm</property>
+ </emphasis> in the name field and <emphasis>
+ <property>sample.GetNameForm</property>
+ </emphasis> for type</para>
+ </listitem>
+ <listitem>
+ <para>Click <emphasis>
+ <property>Finish</property>
+ </emphasis></para>
+ </listitem>
+ <listitem>
+ <para>To save your changes to struts-config.xml, select <emphasis>
+ <property>File > Save</property>
+ </emphasis> from the menu bar</para>
+ </listitem>
+ </itemizedlist>
+ <para>Note the disappearance of the asterisk next to the name, struts-config.xml.</para>
+ </section>
</section>
- <section id="RunningtheApplication">
- <?dbhtml filename="RunningtheApplication.html"?>
- <title>Running the Application</title>
- <para>Everything is now ready for running our application without having to leave JBoss Developer Studio
- by using the JBoss Application Server engine that comes with the JBoss Developer Studio. For controlling
- JBoss AS within JBoss Developer Studio, there is JBoss Server view.</para>
- <figure>
- <title>JBoss Server Panel</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/struts_application/struts_application_6.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <itemizedlist continuation="continues">
-<listitem><para>Start up JBoss AS by clicking on the icon in JBoss Server view. (If JBoss AS is already running, stop it by clicking on the red icon and then start it again. Remember, the Struts run-time requires restarting the servlet engine when any changes have been made.)</para></listitem>
-<listitem><para>After the messages in the Console tabbed view stop scrolling, JBoss AS is available. At this point, right-click on the getName global forward in the struts-config.xml diagram view and select Run on Server.</para></listitem>
- </itemizedlist>
-<para>The browser should appear with the application started.</para>
- </section>
-
- <section id="OtherRelevantResourcesOnTheTopic4">
-<?dbhtml filename="OtherRelevantResourcesOnTheTopic4.html"?>
-<title>Other relevant resources on the topic</title>
-<para>Apache Struts: <ulink url="http://struts.apache.org/">Struts Technology</ulink></para>
-<para>Struts 2: <ulink url="http://struts.apache.org/2.x/">Apache Struts 2</ulink></para>
-<para>Get Started: <ulink url="http://struts.apache.org/2.x/docs/home.html">Struts Getting Started</ulink></para>
-<para>Struts on IBM: <ulink url="http://www.ibm.com/developerworks/library/j-struts/">Struts - An open-source MVC implementation</ulink></para>
-<para>FAQ: <ulink url="http://struts.apache.org/2.x/docs/faqs.html">Struts FAQ</ulink></para>
-<para>Download: <ulink url="http://struts.apache.org/download.cgi#struts206">Release of Apache Struts</ulink></para>
-</section>
</chapter>
\ No newline at end of file
Modified: trunk/struts/docs/struts_tools_tutorial/en/modules/struts_validation.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/modules/struts_validation.xml 2008-04-22 13:20:57 UTC (rev 7683)
+++ trunk/struts/docs/struts_tools_tutorial/en/modules/struts_validation.xml 2008-04-22 14:06:23 UTC (rev 7684)
@@ -8,7 +8,7 @@
<keyword>Struts Validation</keyword>
</keywordset>
</chapterinfo>
-<title>Getting Started Struts Validation Examples</title>
+<title>Struts Validation Examples</title>
<para><property>Validation</property> of input is an important part of any Web application. All Apache Jakarta frameworks,
including Struts, can use a common Jakarta Validation Framework for streamlining this aspect of Web
@@ -259,9 +259,4 @@
<para>The error message should appear in a refreshed version of the form.</para>
</section>
-<section id="OtherResource">
-<?dbhtml filename="OtherResource.html"?>
-<title>Other Resources</title>
- <para>You can also read <ulink url="../../struts_tools_ref_guide/html_single/index.html">Struts Tools Reference Guide</ulink> for more information on this topic.</para>
-</section>
</chapter>
\ No newline at end of file
17 years, 8 months