From jbosstools-commits at lists.jboss.org Thu Jan 29 12:38:13 2009 Content-Type: multipart/mixed; boundary="===============8964891592726016119==" MIME-Version: 1.0 From: jbosstools-commits at lists.jboss.org To: jbosstools-commits at lists.jboss.org Subject: [jbosstools-commits] JBoss Tools SVN: r13349 - branches/jbosstools-3.0.0.CR2/struts/docs/struts_tools_ref_guide/en. Date: Thu, 29 Jan 2009 12:38:13 -0500 Message-ID: --===============8964891592726016119== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ochikvina Date: 2009-01-29 12:38:13 -0500 (Thu, 29 Jan 2009) New Revision: 13349 Added: branches/jbosstools-3.0.0.CR2/struts/docs/struts_tools_ref_guide/en/mast= er_output.xml Log: https://jira.jboss.org/jira/browse/JBDS-571- adding the master_output.xml; Added: branches/jbosstools-3.0.0.CR2/struts/docs/struts_tools_ref_guide/en/= master_output.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/jbosstools-3.0.0.CR2/struts/docs/struts_tools_ref_guide/en/mas= ter_output.xml (rev 0) +++ branches/jbosstools-3.0.0.CR2/struts/docs/struts_tools_ref_guide/en/mas= ter_output.xml 2009-01-29 17:38:13 UTC (rev 13349) @@ -0,0 +1,1262 @@ + + + + + + + + + + + + + + + + + + + + + + = + = = + +]> + + Struts Tools Reference Guide + = + AnatolyFedosik + OlgaChikvina + SvetlanaMukhina<= email>smukhina(a)exadel.com + = + April 2008 + + 2007 + 2008 + JBoss, a division of Red Hat Inc. + + + Version: 3.0.0.CR2 + + + + + + PDF versio= n + + + + + + + = + = + = + + + + + + JBoss Developer Studio + Eclipse + Java + JBoss + + + + Introduction + + If you prefer to develop web applications using Struts technolog= y JBoss Tools also meet + your needs. The professional developer toolset provides all necess= ary editors and wizards + for creating Struts resources that enhances the process of buildin= g high-quality web + applications. + + Note: + Note that JBoss Tools support the Struts 1.1, 1.2.x versions= . + + + In this guide you will learn how to take advantage of Struts sup= port that JBoss Tools + provide. + +
+ Key Features of Struts Tools + + For a start, we propose you to look through the table of mai= n features of Struts + Tools: + + + + Key Functionality for Struts Tools + + + + + + + + + Feature + Benefit + Chapter + + + + + Struts Support + Step-by-step wizards for creating a n= ew struts project with a number + of predefined templates, importing existing on= es and adding struts + capabilities to non-struts web projects. + + struts support + + + + + Support for Struts Configuration File= + Working on file using three modes: di= agram, tree and source. + Synchronization between the modes and full con= trol over the code. Easy + moving around the diagram using the Diagram Na= vigator. Working with + struts projects that have multiple modules. Po= ssibility to use Struts + configuration file debugger allowing to set br= eak points on struts + diagram and then launch the server in debug mo= de. + + graphic= al editor for struts + configu= ration file debugger + + + + + Support for Struts modules + A Struts module (struts-config.xml) i= s automatically created while + creating a new project. There is also possibil= ity to add new ones or edit + already existing modules in your existing proj= ect or while importing Struts project. + + modules + + + + + Verification and Validation + All occuring errors will be immediate= ly reported by verification + feature, no matter in what view you are workin= g. Constant validation and + errors checking allows to catch many of the er= rors during development + process that significantly reduces development= time. + + verific= ation and validation + + + + + +
+ +
+ = +
+ Other relevant resources on the topic + = + All JBoss Developer Studio/JBoss Tools documentation you can= find here. + The latest documentation builds are available here. + = +
+ = +
+ + = + + + + + + JBoss Developer Studio + Eclipse + Java + JBoss + + + + Projects + + JBoss Tools provide the following functionality when working wit= h Struts: + + + + Create new Struts projects + + + Import (open) existing Struts projects. You can import a= ny project + structure + + + Add Struts capabilities to any existing Eclipse + project + + + Import and add Struts capabilities to any existing proje= ct created outside + Eclipse. + + + Now, we'll focus on all these points more fully. + +
+ + Creating a New Struts Project + + + JBoss Tools provides a New Struts Project Wizard that radica= lly simplifies the process + for getting started with a new Struts project. You just need t= o follow these steps: + + + Select + File > New > Pro= ject... + from the menu bar. Then, select + JBoss Tools Web > S= truts > Struts Project + in this dialog box. Click + Next: + + +
+ Selecting Struts Wizard + + + + + +
+ + + On this form, provide the Project Name. You can also + select where to create the project or use the default = path. + Next to Struts Environme= nt set which Struts version to + use. + + + +
+ Creating Struts Project + + + + + +
+ + + Tip: + Don't put spaces in project names since some OS could ex= perience problems + with their processing and searching these files. + + + You can select the KickStart template, then the project crea= ted will include a simple + Hello World type application that is ready to run. + +
+ Choosing Struts Template + + + + + +
+ + + + Next, you register this application with the current= servlet container defined + for your workspace (JBoss AS, by default) in order to = allow you to test your + application more easily while still developing it. A n= ew entry will be added in + the servlet container configuration file to enable run= ning the application + in-place (called null deployment or link deployment). = Uncheck the + "Target Server" + check box if for some reason you don't wan= t to register + your application at this point. + + +
+ Registering The Project at Server + + + + + +
+ + + On the next form, you can select the TLD files to in= clude in this + project: + + +
+ Selecting Tag Libraries + + + + + +
+ + After the project is created, you should have the following = project structure (if you + used the KickStart template): + +
+ Project Structure + + + + + +
+ + + Tip: + If you want to hide the jar files from Web App Libraries= in view, select the + down-pointing arrow in the upper right corner, select + Filters..., check the box next to Nam= e filter patterns + (matching names will be hidden), and type *.jar into the f= ield. Then, click OK. + + +
+
+ + Importing an Existing Struts Project with Any Structure</ti= tle> + + <para>For detailed information on migration projects to JBoss Deve= loper Studio see <ulink url=3D"../../Exadel-migration/html_single/index.htm= l">Migration Guide</ulink>.</para> + + </section> + <section id=3D"AddingStrutsCapabilityToAnExistingWebApplication532"> + + <title>Adding Struts Capability to an Existing Web Application</ti= tle> + + <para>Here, we'll consider how to add Struts functionality (Struts= libraries, tag + libraries and a Struts configuration file) to any existing Web= application project in + your Eclipse workspace.</para> + + <para>By adding a Struts Nature to your project, you can now edit = files using JBoss Tools + editors, such as the <link linkend=3D"struts_config_editor">St= ruts configuration + editor</link> and the JBoss Tools JSP editor. To take advantag= e of this just right-click + the project and select <emphasis> + <property moreinfo=3D"none">JBoss Tools > Add Struts Ca= pabilities</property> + </emphasis> from the context menu. This will start the process= of adding all necessary + libraries and files to make a Web Struts project from your one= .</para> + + <figure float=3D"0"> + <title>Adding Struts Capabilities + + + + + + + + In the wizard you should point to location of your deploymen= t descriptor file web.xml + and name of the project. + +
+ Choosing Project Location + + + + + +
+ After hitting + Next, y= ou will see the following screen. This + screen simply means that you need to add at least one Struts m= odule to your project to + make this project a Struts project. Adding a Struts module mea= ns that a new + struts-config.xml will be added to your project and registered= in the web.xml file. In + addition, all required Struts libraries will be added. To add = a Struts module, select + the + Add Struts Support + button. +
+ Project Modules + + + + + +
+ + Here you can select what Struts = Version, Servlet + Class, URL Pattern and TLDs to add + to this project. + +
+ Selecting Struts Support Options + + + + + +
+ + When done, you will see the default Struts module configurat= ion information. See how + to Edit Struts modules. + +
+ Project Configuration Information + + + + + +
+ + On the last screen you can set the different folders for you= r project as well as + register this application with a servlet container. If you wan= t the libraries (.jar + files) will be automatically added to your project, click on t= he checkbox + Add Libraries. + +
+ Registering the Project at Server + + + + + +
+ + When done, you can open end edit the struts-config.xml file = using usefull Struts + configuration file editor provided by JBDS. (The Struts config= uration is shown below in + the Tree viewer). + +
+ Struts-config.xml File + + + + + +
+
+ +
+ + = + + + + + JBoss Developer Studio + Eclipse + Struts Tools + Java + JBoss + + + + Editors + In this chapter we'll introduce you to featured graphical editor= s for specific + Struts files such as Struts Configuration files, Tiles files and S= truts Validation files. +
+ + Graphical Editor for Struts Configuration Files + First, let's dwell on the Struts Configuration file editor.<= /para> + This editor has three views with different representation o= f + struts-config.xml: = Diagram, Tree and Source. The + views can be selected via the tabs at the bottom of the editor= . Any changes made in one + view are immediately visible when you switch to any other view= . + + Now, we'll consider every view in more detail. +
+ + Diagram View + + The Diagram view graphically displays the Web flow of th= e application defined in + the Struts configuration file. + +
+ Diagram View + + + + + +
+ + The Diagram view allows to edit navigation in your Strut= s application. Just by + right-clicking anywhere on the diagram, you can use a cont= ext menu to create the + building blocks of a Struts application: + + + Actions + + + Global forwards + + + Global exceptions + + + JSP Pages + + + +
+ Diagram Context Menu + + + + + +
+ + Along the upper-left side of the editor is a stack of se= ven icons for changing the + behavior of the cursor in the diagram. + +
+ Editor Icons + + + + + +
+ + The first icon switches to the default regular selection= cursor, the second to the + marquee selection cursor and the third to the new connecti= on cursor. The last four + icons switch the cursor to an insert cursor for each type = of Struts build block + listed above (and in the order listed). + + For instance, clicking on the first of these four icons = (the one with the gears) + will switch the cursor to insert actions. Clicking anywher= e in the diagram with this + cursor has the same effect as right-click and selecting + Add > Action... + from the context menu with the regular cursor = active. It's just + more efficient to use this cursor if you're adding more th= an one action at + once. + + +
+
+ + Tree View + + The Tree view represents the different elements of the S= truts application that are + organized into functional categories on the left-hand side= and a form for editing + the properties of currently selected items on the right-ha= nd side. + +
+ Tree View + + + + + +
+ + You can also right-click on any node in the category tre= e and perform appropriate + operations through a context menu. For instance, by right-= clicking on the + action-mappings category node, you can add new actions to = the application. + +
+ Tree Context Menu + + + + + +
+
+
+ + Source View + + In the Source view, you have complete editing control of= the underlying XML + coding. + +
+ Source View + + + + + +
+ = + When working in Source view, you always have all the fol= lowing features available: + + + Content Assist + + + Open On Selection + + + File Folding + + + You can take advantage of code a= ssist. +
+ Code Assist + + + + + +
+ + The editor will also immediately flag any errors. + +
+ Errors in Source View + + + + + +
+ + Finally, you can use the Outline view with the editor to= easily navigate through + the file. + +
+ Outline View + + + + + +
+ = + Find more information about editor features here. +
+
+ +
+ + Graphical Editor for Tiles Files + Here, you'll know how to make use of the special graphical e= ditor for Tiles configuration files. + The editor has three main views: Tree, Diagram and Source. + The views can be selected via the tabs at the bottom of the ed= itor. Any changes made in + one view are immediately visible when you switch to any other = view. + + Before we consider each view of the editor, let's look at the= way of creating new Tiles files. +
+ + Create New Tiles File + + To create new Tiles files, right click any folder and se= lect + New > Tiles File. +
+ Creating a New Tiles File + + + + + +
+
+
+ + Tree View + + The Tree view represents the different elements of the T= iles file that are + organized into functional categories on the left-hand side= and a form for editing + the properties of currently selected items on the right-ha= nd side. +
+ Tree View + + + + + +
+ + To edit the file, simply right click any node and select= among the available + actions. +
+ Editing in Tiles Editor + + + + + +
+
+
+ + Diagram View + + The Diagram view allows you to create complex Tiles file= s in the form of a + diagram. +
+ Diagram Mode + + + + + +
+ + To create new definitions, simply right click anywhere i= n the diagram. +
+ Creating New Definition + + + + + +
+ + You can also use the Diagram toolbar to make editing eas= ier. +
+ Diagram Toolbar + + + + + +
+ + It contains four icons for changing the cursor state. T= he first one is the + default cursor state for selecting existing nodes. The sec= ond icon is marquee + selector. The third is used for creating new connections a= nd the last one is for + adding definition template to the content. +
+
+ + Source + + The other view of the Tiles = editor is the Source view that + gives you full control over the source. Any changes here w= ill immediately appear in + other modes when you switch to them. + = + When working in Source view, you always have all followi= ng features available: + + + Content Assist + + + Open On Selection + + + = +
+ Source View + + + + + +
+ Code + assist is available in the Source mode. +
+ Code Assist + + + + + +
+ Any errors are immediately reported as shown below: +
+ Errors Reporting + + + + + +
+ + You can also use the Outline view together with the edit= or's Source mode. + It provides an easier navigation through the file. +
+ Outline View + + + + + +
+
+
+ +
+ + Graphical Editor for Struts Validation Files + + Providing full support for development Struts applications J= Boss Tools comes with a + visual validation editor. To open the editor double-click on t= he validation file or if you don't have it create a new one. + = + To create a new validation file, right click any folder = in + Project Explorer and select + File > New > Other... + from the context menu and then + JBoss Tools Web > Struts &g= t; Validation File. +
+ Creating New Validation File + + + + + +
+ + The validation editor works with five modes: Formsets, Valid= ators, Constants and + standard Tree and Source that you can easily switch over using= tabs at the bottom of the + editor. + The Formsets view shows forms and their elements on the left= side and the dialogue for + defining their validation rules on the right side. +
+ Formsets View + + + + + +
+ + The Constants view let you set constant values for your vali= dation rules. +
+ Constansts View + + + + + +
+ + The validation file can also be viewed in a Tree view. +
+ Tree View + + + + + +
+ + At any point you have full control over the source by switch= ing to the Source view. + Any editing in this view will immediately be available in othe= r views of the editor. +
+ Source View + + + + + +
+ + You can also open your own custom or Struts-standard + validation-rules.xml + file. + The Validators view shows the validation rules for a selecte= d validator. You can of + course add your own rules. +
+ Validators View + + + + + +
+ Here are the validation rules shown in the Source mode. +
+ Validation Rules + + + + + +
+
+
+ + = + + + + + JBoss Developer Studio + Eclipse + Struts Tools + Java + JBoss + + + = + Modules + = + JBoss Tools support working with Struts projects that have + multiple modules. You can easily do the following: + + + Add new modules + + + Edit modules for an existing project or during Struts pr= oject + import + + + Now, let's discuss this functionality in more detail. +
+ = + When Importing a Struts Project + = + During Struts project import, if the project has multiple mo= dules, you + will see a screen with all existing modules. You can select ea= ch + module and edit its details. + = +
+ Configuring Project Modules + + + + + +
+
+
+ = + Editing Modules in an Existing Project + To edit modules in an existing project, right click the proj= ect and + select + JBoss Tools > Modules Confi= guration. + +
+ Choosing Modules Configuration + + + + + +
+ You will see the same screen as above where you will be able= to select + a module and edit its details. +
+ Modules Configuration + + + + + +
+
+
+ = + Adding New Modules + = + Adding a new module is very simple. First switch to Web Proj= ect view. + Expand your project to the Configuration folder. Under that fo= lder + you should see the current modules. Right click on Configurati= on and + select + New > Struts Config. +
+ Adding New Modules + + + + + +
+ You will see the screen below. You can specify a new module = name and + also add the new Struts configuration file to web.xml file. +
+ Adding New Modules + + + + + +
+
+
+ + = + + + = + + + JBoss Developer Studio + Eclipse + Struts Tools + Java + JBoss + + + = + Code Generation + = + JBoss Tools comes with a code genera= tion + feature. You can generate stub code for Struts Actions, FormBeans,= Forwards + and Exceptions. + = + The code generation that JBoss tooling provides is based on Velo= city templates + which can be modified for your use. The templates are located at <= emphasis> + {JBossStudioHome} > templates = > + codegeneration. + = + There are a number of ways to invoke code generation. One is sim= ply + right-clicking the Struts diagram and selecting + Generate Java Code.... + + = +
+ Selecting Generate Java Code + + + + + +
+ = + On this screen you can select for which elements to generate cod= e. If you + select Next you will be able to specify more options for each of t= he + categories you selected. + = +
+ Generate - Step 1 + + + + + +
+ = + + Tip: + Please be careful not to override your existing files. + + = + When generation is complete, a result window will appear letting= you know how + many classes were generated: + = +
+ Generation Finished + + + + + +
+ = + You don't always have to generate code for all elements at once.= You + can invoke generation for just an individual Struts artifact as we= ll. + Right-click an element on the diagram of the Struts configuration = file and + select + Generate Java Code... + from the context menu. + = +
+ Generation For Individual Struts Artifact + + + + + +
+ = + The same can be done from within the Tree viewer for the editor = of the Struts + configuration file. + = +
+ Generation in Struts Config Editor + + + + + +
+
+ = + + + + + JBoss Developer Studio + Eclipse + Struts Tools + Java + JBoss + + + = + Struts Configuration File Debugger + = + JBoss Tools come with Struts configu= ration file + debugger. It allows you to set break points on Struts d= iagram and + then simply launch the server in debug mode. + = + Simply right click an Action or a page and select Add + Breakpoint. +
+ Adding Breakpoint + + + + + +
+
+ = + + + = + + + JBoss Developer Studio + Eclipse + Java + JBoss + + + = + Customizable Page Links Recognizer + = + Custom page links allow y= ou to define custom Struts page + links that will be recognizable in the Struts application diagram.= You can + define these links by selecting + Window > Preferences + from the menu bar and then selecting + JBoss Tools > Web > Struts &= gt; Customization + from the Preferences dialog box. +
+ Customization Panel + + + + + +
+
+ = + + + + + JBoss Developer Studio + Eclipse + Struts Tools + Java + JBoss + + + = + Struts Project Verification + = + In this section we'll consider one more functionality that JBoss= Tools provide for Struts + projects, namely adjusting projects verification. + = + To configure Struts project verification select + Window > Preferences + from the menu bar, select + JBoss Tools > Web > Verifica= tion + from the Preferences dialog box and then expand the + Struts Rules node. +
+ Struts Rules + + + + + +
+ Suppose you are working in the Source viewer for a Struts + configuration file as shown below: +
+ Struts Configuration File + + + + + +
+ While typing a class name or entering it from the graphical edit= or, + you might make a minor typo (like + "sample.GreetingAction1" + instead of + "sample.GreetingAction" + ). After saving the file, + verification checks to make= sure everything is + correct and finds the error below: +
+ Error Reporting + + + + + +
+ Notice that the Package Explorer View shows a marked folder and a + marked file where the error is. + You can place the cursor over the line with the error to view a + detailed error message: +
+ Error Message + + + + + +
+ The verification also checks to make sure you have specified the + correct JSP page for the forward: +
+ JSP Page Verification + + + + + +
+ Once you place the cursor over the line, you can see the error + message: +
+ Error Message + + + + + +
+ You can always invoke the verification by switching to the Diagr= am + viewer, right-clicking and selecting + Verify + from the context menu: +
+ Verify Command + + + + + +
+
+ = + + + + + JBoss Developer Studio + Eclipse + Struts Tools + Java + JBoss + + + + Relevant Resources Links + + Find out necessary information on Struts + technology if you don't know enough. + + In summary, this reference should help you to get familiar w= ith those parts of + JBoss Tools= which are meant for development with Struts + technology. If you've carefully gone through the document,= you should know + now how to create/import Struts project or enable Struts c= apabilities for an + existing web project as well as organize and edit all nece= ssary staff for your + Struts application using a set of views and editors provid= ed by JBoss + Tools. + + If you'd like to contribute your feedback is always apprecia= ted. You can + leave your questions and suggestions on our Forum. + + +
--===============8964891592726016119==--