Repository: struts-site Updated Branches: refs/heads/master 2423050b6 -> b93572c86
Adds back and forth navigation links Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/ccdbffb9 Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/ccdbffb9 Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/ccdbffb9 Branch: refs/heads/master Commit: ccdbffb90b3f940abccb7b269d3879c3f0deeff0 Parents: 2423050 Author: Lukasz Lenart <lukasz.len...@gmail.com> Authored: Wed Apr 12 09:47:42 2017 +0200 Committer: Lukasz Lenart <lukasz.len...@gmail.com> Committed: Wed Apr 12 09:47:42 2017 +0200 ---------------------------------------------------------------------- source/getting-started/annotations.md | 2 + source/getting-started/coding-actions.md | 1 + source/getting-started/control-tags.md | 2 + source/getting-started/debugging-struts.md | 4 +- source/getting-started/exception-handling.md | 2 + source/getting-started/exclude-parameters.md | 2 + source/getting-started/form-tags.md | 223 +++++++++++++------ .../form-validation-using-xml.md | 2 + source/getting-started/form-validation.md | 2 + .../hello-world-using-struts2.md | 2 + .../how-to-create-a-struts2-web-application.md | 2 + source/getting-started/http-session.md | 2 + .../getting-started/introducing-interceptors.md | 2 + .../getting-started/message-resource-files.md | 2 + source/getting-started/preperable-interface.md | 2 + source/getting-started/processing-forms.md | 2 + source/getting-started/spring.md | 2 + source/getting-started/themes.md | 2 + source/getting-started/unit-testing.md | 2 + source/getting-started/using-tags.md | 2 + .../wildcard-method-selection.md | 2 + 21 files changed, 189 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/annotations.md ---------------------------------------------------------------------- diff --git a/source/getting-started/annotations.md b/source/getting-started/annotations.md index 67c2b29..2ba1234 100644 --- a/source/getting-started/annotations.md +++ b/source/getting-started/annotations.md @@ -92,3 +92,5 @@ When we don't use a struts.xml file, we can set the value of these Struts 2 para __Summary__ We've just scratched the surface of what the Struts 2 convention plugin provides to reduce or eliminate the need to use an XML file to configure your Struts 2 application. The Struts 2 Convention plugin provides ways to map multiple actions to the same method, map results to different view pages, map errors to view pages, and much more. Be sure to read through the [Convention Plugin](//struts.apache.org/docs/convention-plugin.html) documentation for alternative ways to configure your Struts 2 application. + +|Return to [Spring and Struts 2](spring.html)|or|onward to [Introducing Interceptors](introducing-interceptors.html)| \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/coding-actions.md ---------------------------------------------------------------------- diff --git a/source/getting-started/coding-actions.md b/source/getting-started/coding-actions.md index 8922e96..a277d39 100644 --- a/source/getting-started/coding-actions.md +++ b/source/getting-started/coding-actions.md @@ -116,3 +116,4 @@ __Summary__ This tutorial introduced you to how to code the Action class so it can process user input on a form or values in a query string parameter. If the form had numerous fields, it would be cumbersome to have a set method that matches up with each form field. So our next tutorial will cover how to integrate a model class, form fields in the view and form processing in the Action class. +|Return to [Using Struts 2 Tags](using-tags.html)|or|onward to [Processing Forms](processing-forms.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/control-tags.md ---------------------------------------------------------------------- diff --git a/source/getting-started/control-tags.md b/source/getting-started/control-tags.md index edcc083..d7fcb3a 100644 --- a/source/getting-started/control-tags.md +++ b/source/getting-started/control-tags.md @@ -77,3 +77,5 @@ The value of the iterator tag is states, which causes the Struts 2 framework to __Additional Iterator Attributes__ The Struts 2 iterator tag has additional attributes you can use to control the begin and end values for specifying that the iterator tag should only loop over a part of the collection. See the [iterator tag reference](https://cwiki.apache.org/confluence/display/WW/iterator) for more information. + +|Return to [Form validation using XML](form-validation-using-xml.md)|or|onward to [Wildcard method selection](wildcard-method-selection.html)| \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/debugging-struts.md ---------------------------------------------------------------------- diff --git a/source/getting-started/debugging-struts.md b/source/getting-started/debugging-struts.md index 9c38375..e28854a 100644 --- a/source/getting-started/debugging-struts.md +++ b/source/getting-started/debugging-struts.md @@ -19,7 +19,7 @@ The Struts 2 config browser plugin provides details about the configuration the To use the plugin in your application, just call index.action in namespace config-browser. For example you could have the following link on your admin page (or just anywhere during your development). ```html -<a href="<s:url action="index" namespace="config-browser" />">Launch the configuration browser</a> +<a href='<s:url action="index" namespace="config-browser" />'>Launch the configuration browser</a> ``` In the example application, there is a link to the configuration browser on the index.jsp page. @@ -57,3 +57,5 @@ __Summary__ Using the configuration browser plugin and the debugging interceptor can assist you in trouble shooting a problem with a Struts 2 web application. These tools should only be used in development. Prior to creating your war file for deployment to production you should change devmode to false and remove the debugging links. You may also want to adjust the level of logging in your log properties file to a higher level (info or warn) to reduce the number of log messages. + +|Return to [Exception handling](exception-handling.html)|or|onward to [Form tags](form-tags.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/exception-handling.md ---------------------------------------------------------------------- diff --git a/source/getting-started/exception-handling.md b/source/getting-started/exception-handling.md index 6a08993..ac34450 100644 --- a/source/getting-started/exception-handling.md +++ b/source/getting-started/exception-handling.md @@ -96,3 +96,5 @@ When the exception interceptor is triggered it adds to the fields available for __Summary__ Struts 2 provides a easy to use configuration for handling uncaught exceptions and redirecting users to appropriate view pages. You can configure exception handling to be global for all actions or to just for a specific action. You can also enable the Struts 2 framework to log the uncaught exceptions. + +|Return to [Message resource files](message-resource-files.html)|or|onward to [Debugging Struts](debugging-struts.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/exclude-parameters.md ---------------------------------------------------------------------- diff --git a/source/getting-started/exclude-parameters.md b/source/getting-started/exclude-parameters.md index 1b87a31..4d23bcb 100644 --- a/source/getting-started/exclude-parameters.md +++ b/source/getting-started/exclude-parameters.md @@ -84,3 +84,5 @@ To see the log messages written when not excluding the submit parameter remove t __Summary__ It's a nice feature of the Struts 2 framework that it logs during development which request parameters will and will not be processed. During development of a Struts 2 web application it's a good practice to review these log messages to determine if there are any parameters that the framework should not process. For those parameters the Struts 2 framework should not process add the parameter name (or a regular expression that can be used to identify multiple parameter names) to the comma-delimited list that is the value for the `<param name="params.excludeParams">` node. + +|Return to [Preparable Interface](preperable-interface.html)|or|back to [Getting started](index.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/form-tags.md ---------------------------------------------------------------------- diff --git a/source/getting-started/form-tags.md b/source/getting-started/form-tags.md index baa7bcc..f64f56b 100644 --- a/source/getting-started/form-tags.md +++ b/source/getting-started/form-tags.md @@ -8,25 +8,37 @@ The example code for this tutorial, form_tags, can be checked out from [https:// __Introduction__ -In this tutorial we'll explore some of the other Struts 2 form controls. In our previous tutorials that explained how to use Struts 2 forms ([Processing Forms](processing-forms.html) , [Form Validation](form-validation.html) , and [Message Resource Files](message-resource-files.html) ) we covered how to use the Struts 2 head, form, textfield controls and the key attribute. This tutorial will explore using the Struts 2 select, radio, checkbox, and checkboxlist form controls. +In this tutorial we'll explore some of the other Struts 2 form controls. In our previous tutorials that explained how +to use Struts 2 forms ([Processing forms](processing-forms.html), [Form validation](form-validation.html), +and [Message resource files](message-resource-files.html) ) we covered how to use the Struts 2 head, form, textfield +controls and the key attribute. This tutorial will explore using the Struts 2 select, radio, checkbox, and checkboxlist +form controls. -The [Struts 2 user mailing list](http://struts.apache.org/mail.html) is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don't find an answer to your problem, post a question on the mailing list. +The [Struts 2 user mailing list](http://struts.apache.org/mail.html) is an excellent place to get help. If you are +having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don't find +an answer to your problem, post a question on the mailing list. __Example Application__ -The example application that supports this tutorial shows how to use Struts 2 form tags so that a user can edit his information. The information that can be edited is encapsulated in an object of class Person. A Person object knows these things: first name, last name, favorite sport, gender, state of residency, is or is not over 21, and car models owned. +The example application that supports this tutorial shows how to use Struts 2 form tags so that a user can edit his +information. The information that can be edited is encapsulated in an object of class Person. A Person object knows +these things: first name, last name, favorite sport, gender, state of residency, is or is not over 21, and car models +owned. To enable the user to edit his information that is stored in the Person object, we need to create a form like this one:  -The form allows the user to make changes. After submitting the form, the Struts 2 framework will update the state of the Person object. +The form allows the user to make changes. After submitting the form, the Struts 2 framework will update the state +of the Person object. -The first and last names are shown on the form (see edit.jsp) using the Struts 2 textfield tag, which we've discussed in previous tutorials. +The first and last names are shown on the form (see edit.jsp) using the Struts 2 textfield tag, which we've discussed +in previous tutorials. __Struts 2 Select Tag__ -A user can select one favorite sport from several choices. The example application uses the Struts 2 select tag to provide the list of options for the select box. +A user can select one favorite sport from several choices. The example application uses the Struts 2 select tag +to provide the list of options for the select box. **Struts 2 Select Tag** @@ -34,13 +46,25 @@ A user can select one favorite sport from several choices. The example applicati <s:select key="personBean.sport" list="sports" /> ``` -In these form tags, we are using the key attribute as discussed in the [Message Resource Files](message-resource-files.html) tutorial. The key attribute is used by the Struts 2 framework to determine values for the other attributes (e.g. label and value). We are also using a property file associated with the EditAction class to provide the label values based on the key attribute value (see the [Message Resource Files](message-resource-files.html) tutorial for information on using Struts 2 property files). +In these form tags, we are using the key attribute as discussed in the [Message resource files](message-resource-files.html) +tutorial. The key attribute is used by the Struts 2 framework to determine values for the other attributes (e.g. label +and value). We are also using a property file associated with the EditAction class to provide the label values based on +the key attribute value (see the [Message Resource Files](message-resource-files.html) tutorial for information on using +Struts 2 property files). -> Note that there are many attributes for the Struts 2 form tags, most of which mirror the HTML attributes associated with the tags. You can read about all the attributes for a Struts 2 form tag by consulting the Struts 2 documentation. +> Note that there are many attributes for the Struts 2 form tags, most of which mirror the HTML attributes associated +> with the tags. You can read about all the attributes for a Struts 2 form tag by consulting the Struts 2 documentation. -The value of the list attribute of the Struts 2 select tag is used by the framework to determine what method of the action class to call in order to create the option values. In our example application, the list attribute value of "sports" results in the framework calling the getSports method of class EditAction. That method returns a String array containing "football", "baseball", and "basketball". Those values are used to create the option tags inside the select tag. +The value of the list attribute of the Struts 2 select tag is used by the framework to determine what method +of the action class to call in order to create the option values. In our example application, the list attribute +value of "sports" results in the framework calling the getSports method of class EditAction. That method returns +a String array containing "football", "baseball", and "basketball". Those values are used to create the option tags +inside the select tag. -The Struts 2 framework determines which option is preselected by using the key attribute's value to call a method on the personBean object. Since the key attribute's value is "personBean.sport", the framework calls the personBean object's getSport method. If the value returned by that method matches one of the option values, that option will be marked as "selected". +The Struts 2 framework determines which option is preselected by using the key attribute's value to call a method +on the personBean object. Since the key attribute's value is "personBean.sport", the framework calls the personBean +object's getSport method. If the value returned by that method matches one of the option values, that option will be +marked as "selected". Here is the HTML that results from using the above Struts 2 select tag. @@ -48,26 +72,29 @@ Here is the HTML that results from using the above Struts 2 select tag. ```html <tr> -<td class="tdLabel"> -<label for="save_personBean_sport" class="label">Favorite sport:</label> -</td> -<td> -<select name="personBean.sport" id="save_personBean_sport"> - <option value="football">football</option> - <option value="baseball">baseball</option> - <option value="basketball" selected="selected">basketball</option> -</select> -</td> + <td class="tdLabel"> + <label for="save_personBean_sport" class="label">Favorite sport:</label> + </td> + <td> + <select name="personBean.sport" id="save_personBean_sport"> + <option value="football">football</option> + <option value="baseball">baseball</option> + <option value="basketball" selected="selected">basketball</option> + </select> + </td> </tr> ``` -Note the table formatting created by the Struts 2 framework when using the Struts 2 select tag. The CSS classes are defined in style sheets included by the Struts 2 s:head tag. The Struts 2 s:head tag is placed inside the edit.jsp's head section. +Note the table formatting created by the Struts 2 framework when using the Struts 2 select tag. The CSS classes are +defined in style sheets included by the Struts 2 s:head tag. The Struts 2 s:head tag is placed inside the edit.jsp's +head section. Since the personBean's getSport method returns "baskeball", the basketball option value is marked as selected. __Struts 2 Radio Tag__ -The Struts 2 radio tagâlike its standard HTML counterpartâis used to display 2 or more choices, only one of which can be selected by the user. Here is the code for the Struts 2 radio button from the example application. +The Struts 2 radio tagâlike its standard HTML counterpartâis used to display 2 or more choices, only one of which can +be selected by the user. Here is the code for the Struts 2 radio button from the example application. **Struts 2 Radio Tag** @@ -75,27 +102,40 @@ The Struts 2 radio tagâlike its standard HTML counterpartâis used to display <s:radio key="personBean.gender" list="genders" /> ``` -Again the key attribute's value determines the value for the label and value attributes. The label's text is derived from the EditAction.properties file (key personBean.gender). Just like the Struts 2 select tag, the list attribute of the Struts 2 radio tag causes the framework to call the getGenders method of the EditAction class. The Array of String objects returned are used to create the individual radio buttons. +Again the key attribute's value determines the value for the label and value attributes. The label's text is derived +from the EditAction.properties file (key personBean.gender). Just like the Struts 2 select tag, the list attribute +of the Struts 2 radio tag causes the framework to call the getGenders method of the EditAction class. +The Array of String objects returned are used to create the individual radio buttons. **HTML Created By Struts 2 Radio Tag** ```html <tr> -<td class="tdLabel"> -<label for="save_personBean_gender" class="label">Gender:</label></td> -<td> -<input type="radio" name="personBean.gender" id="save_personBean_gendermale" value="male"/><label for="save_personBean_gendermale">male</label> -<input type="radio" name="personBean.gender" id="save_personBean_genderfemale" value="female"/><label for="save_personBean_genderfemale">female</label> -<input type="radio" name="personBean.gender" id="save_personBean_gendernot sure" checked="checked" value="not sure"/><label for="save_personBean_gendernot sure">not sure</label> -</td> + <td class="tdLabel"> + <label for="save_personBean_gender" class="label">Gender:</label> + </td> + <td> + <input type="radio" name="personBean.gender" id="save_personBean_gendermale" value="male"/> + <label for="save_personBean_gendermale">male</label> + + <input type="radio" name="personBean.gender" id="save_personBean_genderfemale" value="female"/> + <label for="save_personBean_genderfemale">female</label> + + <input type="radio" name="personBean.gender" id="save_personBean_gendernot sure" checked="checked" value="not sure"/> + <label for="save_personBean_gendernot sure">not sure</label> + </td> </tr> ``` -Also just like the Struts 2 select tag the result returned by calling the personBean object's getGender method is used to determine which of the radio buttons is checked. +Also just like the Struts 2 select tag the result returned by calling the personBean object's getGender method is used +to determine which of the radio buttons is checked. __Struts 2 Select Tag - Object Backed__ -You may need to create a Struts 2 select tag where the options displayed to the user each have their own value that is different then what is displayed. In the example application, the user's residency is stored as a two-letter abbreviation (e.g. KS), but the form select box should display the full state name (e.g. Kansas). To create such a select box in Struts 2, you would use this code +You may need to create a Struts 2 select tag where the options displayed to the user each have their own value that is +different then what is displayed. In the example application, the user's residency is stored as a two-letter +abbreviation (e.g. KS), but the form select box should display the full state name (e.g. Kansas). To create such +a select box in Struts 2, you would use this code **Struts 2 Select Tag Object Backed** @@ -103,33 +143,42 @@ You may need to create a Struts 2 select tag where the options displayed to the <s:select key="personBean.residency" list="states" listKey="stateAbbr" listValue="stateName" /> ``` -The list value tells the framework to call the getStates method of the EditAction class. That method returns an ArrayList of State objects. Each State object has getStateAbbr and getStateName methods. +The list value tells the framework to call the getStates method of the EditAction class. That method returns +an ArrayList of State objects. Each State object has getStateAbbr and getStateName methods. -The listKey attribute tells the framework to use the value returned by calling the getStateAbbr method as the value for the value attribute of the HTML option tag and the value returned by calling the getStateName method as the value displayed to the user. So the above Struts 2 select tag code results in this HTML. +The listKey attribute tells the framework to use the value returned by calling the getStateAbbr method as the value for +the value attribute of the HTML option tag and the value returned by calling the getStateName method as the value +displayed to the user. So the above Struts 2 select tag code results in this HTML. **HTML Created By Struts 2 Select Tag** ```html <tr> -<td class="tdLabel"> -<label for="save_personBean_residency" class="label">State resident:</label></td> -<td> -<select name="personBean.residency" id="save_personBean_residency"> - <option value="AZ">Arizona</option> - <option value="CA">California</option> - <option value="FL">Florida</option> - <option value="KS" selected="selected">Kansas</option> - <option value="NY">New York</option> -</select> -</td> + <td class="tdLabel"> + <label for="save_personBean_residency" class="label">State resident:</label> + </td> + <td> + <select name="personBean.residency" id="save_personBean_residency"> + <option value="AZ">Arizona</option> + <option value="CA">California</option> + <option value="FL">Florida</option> + <option value="KS" selected="selected">Kansas</option> + <option value="NY">New York</option> + </select> + </td> </tr> ``` -The value returned by calling the personBean object's getResidency method determines which of the select tag's option tags is marked as selected. In our example, since getResidency returns "KS", the option tag whose value attribute equals "KS" is marked as selected. +The value returned by calling the personBean object's getResidency method determines which of the select tag's option +tags is marked as selected. In our example, since getResidency returns "KS", the option tag whose value attribute +equals "KS" is marked as selected. __Struts 2 Checkbox Tag__ -The Struts 2 checkbox tag is used to create the HTML input type equals checkbox tag. The value for the key attribute tells the framework what method to call to determine if the checkbox is checked or not checked. The method called should return a Boolean value (true or false). A return value of true will cause the checkbox to be checked and false the checkbox will not be checked. +The Struts 2 checkbox tag is used to create the HTML input type equals checkbox tag. The value for the key attribute +tells the framework what method to call to determine if the checkbox is checked or not checked. The method called should +return a Boolean value (true or false). A return value of true will cause the checkbox to be checked and false +the checkbox will not be checked. **Struts 2 Checkbox Tag** @@ -143,24 +192,34 @@ Since the method getOver21 returns true, the checkbox is checked. ```html <tr> -<td valign="top" align="right"> -</td> -<td valign="top" align="left"> -<input type="checkbox" name="personBean.over21" value="true" checked="checked" id="save_personBean_over21"/> -<input type="hidden" id="__checkbox_save_personBean_over21" name="__checkbox_personBean.over21" value="true" /> <label for="save_personBean_over21" class="checkboxLabel">21 or older</label> -</td> + <td valign="top" align="right"></td> + <td valign="top" align="left"> + <input type="checkbox" name="personBean.over21" value="true" checked="checked" id="save_personBean_over21"/> + <input type="hidden" id="__checkbox_save_personBean_over21" name="__checkbox_personBean.over21" value="true" /> + <label for="save_personBean_over21" class="checkboxLabel">21 or older</label> + </td> </tr> ``` -When the form is submitted and the checkbox is not checked, no value will be posted for the checkbox (this is how HTML forms work). Since the Struts 2 framework will need to update the value of the personBean's over21 instance field to falseâgiven that the check box was not checkedâthe framework needs a way to determine if the checkbox was not checked after form submission. +When the form is submitted and the checkbox is not checked, no value will be posted for the checkbox (this is how HTML +forms work). Since the Struts 2 framework will need to update the value of the personBean's over21 instance field +to falseâgiven that the check box was not checkedâthe framework needs a way to determine if the checkbox was not checked +after form submission. -If you examine the HTML code created by the Struts 2 checkbox tag, you'll see that it created a hidden field associated with the personBean.over21 checkbox. When the Struts 2 framework intercepts the submission of this form it will use this hidden form field to check if the associated checkbox field exists in the posted form data. If that checkbox field doesn't exist then the Struts 2 framework will know to update the value of the personBean object's over21 instance variable to false. +If you examine the HTML code created by the Struts 2 checkbox tag, you'll see that it created a hidden field associated +with the personBean.over21 checkbox. When the Struts 2 framework intercepts the submission of this form it will use this +hidden form field to check if the associated checkbox field exists in the posted form data. If that checkbox field +doesn't exist then the Struts 2 framework will know to update the value of the personBean object's over21 instance +variable to false. __Struts 2 checkboxlist Tag__ -The Struts 2 framework provides a unique form field control that creates a series of associated check boxes, one or more of which can be checked. In the example application, the Person class has an Array of Strings, which is used to store car models owned by a person. +The Struts 2 framework provides a unique form field control that creates a series of associated check boxes, one or more +of which can be checked. In the example application, the Person class has an Array of Strings, which is used to store +car models owned by a person. -Using the Struts 2 checkbox tag, we can create a series of checkboxes, one for each possible car model the user may own. The value of each String in the personBean's carModels Array will determine which checkboxes are checked. +Using the Struts 2 checkbox tag, we can create a series of checkboxes, one for each possible car model the user may own. +The value of each String in the personBean's carModels Array will determine which checkboxes are checked. **Struts 2 Checkboxlist Tag** @@ -168,29 +227,45 @@ Using the Struts 2 checkbox tag, we can create a series of checkboxes, one for e <s:checkboxlist key="personBean.carModels" list="carModelsAvailable" /> ``` -The list attributes value in the checkboxlist tag tells the Struts 2 framework which method to call to get the possible car models. In the example application, the framework will call the EditAction class's getCarModelsAvailable method. That method returns an Array of Strings. For each element of the Array, the Struts 2 framework creates a checkbox (including the associated hidden field described above). +The list attributes value in the checkboxlist tag tells the Struts 2 framework which method to call to get the possible +car models. In the example application, the framework will call the EditAction class's getCarModelsAvailable method. +That method returns an Array of Strings. For each element of the Array, the Struts 2 framework creates a checkbox +(including the associated hidden field described above). -The key attribute value in the checkboxlist tag tells the Struts 2 framework which method to call on the personBean object to determine which checkboxes should be checked. In the example application, the framework will call the personBean object's getCarModels method. The getCarModels method returns an Array of Strings. For each String value in that Array that matches a String value in the Array returned by the EditAction class's getCarModelsAvailable, the checkbox will be checked. +The key attribute value in the checkboxlist tag tells the Struts 2 framework which method to call on the personBean +object to determine which checkboxes should be checked. In the example application, the framework will call +the personBean object's getCarModels method. The getCarModels method returns an Array of Strings. For each String value +in that Array that matches a String value in the Array returned by the EditAction class's getCarModelsAvailable, +the checkbox will be checked. **HTML Created By Struts 2 Checkboxlist Tag** ```html <tr> -<td class="tdLabel"> -<label for="save_personBean_carModels" class="label">Car models owned:</label></td> -<td> -<input type="checkbox" name="personBean.carModels" value="Ford" id="personBean.carModels-1" checked="checked"/> -<label for="personBean.carModels-1" class="checkboxLabel">Ford</label> -<input type="checkbox" name="personBean.carModels" value="Chrysler" id="personBean.carModels-2"/> -<label for="personBean.carModels-2" class="checkboxLabel">Chrysler</label> -<input type="checkbox" name="personBean.carModels" value="Toyota" id="personBean.carModels-3"/> -<label for="personBean.carModels-3" class="checkboxLabel">Toyota</label> -<input type="checkbox" name="personBean.carModels" value="Nissan" id="personBean.carModels-4" checked="checked"/> -<label for="personBean.carModels-4" class="checkboxLabel">Nissan</label> -<input type="hidden" id="__multiselect_save_personBean_carModels" name="__multiselect_personBean.carModels" value="" /> -</td> + <td class="tdLabel"> + <label for="save_personBean_carModels" class="label">Car models owned:</label> + </td> + <td> + <input type="checkbox" name="personBean.carModels" value="Ford" id="personBean.carModels-1" checked="checked"/> + <label for="personBean.carModels-1" class="checkboxLabel">Ford</label> + + <input type="checkbox" name="personBean.carModels" value="Chrysler" id="personBean.carModels-2"/> + <label for="personBean.carModels-2" class="checkboxLabel">Chrysler</label> + + <input type="checkbox" name="personBean.carModels" value="Toyota" id="personBean.carModels-3"/> + <label for="personBean.carModels-3" class="checkboxLabel">Toyota</label> + + <input type="checkbox" name="personBean.carModels" value="Nissan" id="personBean.carModels-4" checked="checked"/> + <label for="personBean.carModels-4" class="checkboxLabel">Nissan</label> + <input type="hidden" id="__multiselect_save_personBean_carModels" name="__multiselect_personBean.carModels" value="" /> + </td> </tr> ``` -Summary - There are several other Struts 2 form controls you should explore. If you need more information about the Struts 2 form tags consult the Struts 2 documentation at [http://struts.apache.org](http://struts.apache.org). +__Summary__ + +There are several other Struts 2 form controls you should explore. If you need more information about the Struts 2 form +tags consult the Struts 2 documentation at [http://struts.apache.org](http://struts.apache.org). + +|Return to [Debugging Struts](debugging-struts.html)|or|onward to [Form validation using XML](form-validation-using-xml.html)| + http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/form-validation-using-xml.md ---------------------------------------------------------------------- diff --git a/source/getting-started/form-validation-using-xml.md b/source/getting-started/form-validation-using-xml.md index 88e576f..8204a89 100644 --- a/source/getting-started/form-validation-using-xml.md +++ b/source/getting-started/form-validation-using-xml.md @@ -121,3 +121,5 @@ The fieldexpression validator is useful when doing conditional validation of a u __Summary__ The Struts 2 framework provides easy-to-use validation methodologies. You can add a validate method to the Action class or have a separate XML file with validation rules or you can use a combination of both methodologies. + +|Return to [Form tags](form-tags.html)|or|onward to [Control tags](control-tags.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/form-validation.md ---------------------------------------------------------------------- diff --git a/source/getting-started/form-validation.md b/source/getting-started/form-validation.md index bf4a3b4..bdcbbb3 100644 --- a/source/getting-started/form-validation.md +++ b/source/getting-started/form-validation.md @@ -93,3 +93,5 @@ This tutorial covered validating a user's form input by adding a validate method __Up Next__ In our next tutorial we'll cover how to use message resource files to separate out the text from the view page. + +|Return to [Processing Forms](processing-forms.html)|or|onward to [Message resource files](message-resource-files.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/hello-world-using-struts2.md ---------------------------------------------------------------------- diff --git a/source/getting-started/hello-world-using-struts2.md b/source/getting-started/hello-world-using-struts2.md index dd62365..04c3004 100644 --- a/source/getting-started/hello-world-using-struts2.md +++ b/source/getting-started/hello-world-using-struts2.md @@ -217,3 +217,5 @@ Your browser sends to the web server a request for the URL [http://localhost:808 The framework uses Actions to process HTML forms and other requests. The `Action` class returns a result-name such as `SUCCESS`, `ERROR` or `INPUT`. Based on the mappings loaded from the `struts.xml`, a given result-name may select a page (as in this example), another action, or some other web resource (image, PDF). When a server page is rendered, most often it will include dynamic data provided by the Action. To make it easy to display dynamic data, the framework provides a set of tags that can be used along with HTML markup to create a server page. + +|Return to [How to create a Struts 2 web application](how-to-create-a-struts2-web-application.html)|or|onward to [Using Struts 2 Tags](using-tags.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/how-to-create-a-struts2-web-application.md ---------------------------------------------------------------------- diff --git a/source/getting-started/how-to-create-a-struts2-web-application.md b/source/getting-started/how-to-create-a-struts2-web-application.md index d608b99..7a84838 100644 --- a/source/getting-started/how-to-create-a-struts2-web-application.md +++ b/source/getting-started/how-to-create-a-struts2-web-application.md @@ -225,3 +225,5 @@ __Getting Help__ The [Struts 2 user mailing list](/mail.html) is an excellent place to get help. If you are having a problem getting this Basic Struts 2 application to work search the Struts 2 mailing list. If you don't find an answer to your problem, post a question on the mailing list. + +|Return to [Getting started](index.html)|or|onward to [Hello World using Struts 2](hello-world-using-struts2.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/http-session.md ---------------------------------------------------------------------- diff --git a/source/getting-started/http-session.md b/source/getting-started/http-session.md index ccd598f..852b934 100644 --- a/source/getting-started/http-session.md +++ b/source/getting-started/http-session.md @@ -115,3 +115,5 @@ The example project includes both methods for mitigating the SessionAware securi __Summary__ When your Action class needs to access the HTTP session object implement the SessionAware interface and override the setSession method. Be sure to also implement the ParameterNameAware interface and override the acceptableParameterName method to mitigate a potential security vulnerability. If you have multiple actions that implement SessionAware then consider modifying the params interceptor's excludeParams value as part of your Struts 2 package setup. + +|Return to [Unit Testing](unit-testing.html)|or|onward to [Preparable Interface](preperable-interface.html)| \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/introducing-interceptors.md ---------------------------------------------------------------------- diff --git a/source/getting-started/introducing-interceptors.md b/source/getting-started/introducing-interceptors.md index 4c2a503..66cd51b 100644 --- a/source/getting-started/introducing-interceptors.md +++ b/source/getting-started/introducing-interceptors.md @@ -110,3 +110,5 @@ In addition to specifying your own stack of interceptors, you can also write you __Summary__ Interceptors provide the Struts 2 framework with both power and flexibility. Developers may add additional interceptors (either ones provided by Struts 2 or ones they create) to the stack of interceptors executed when an Action class is called. + +|Return to [Annotations](annotations.html)|or|onward to [Unit Testing](unit-testing.html)| \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/message-resource-files.md ---------------------------------------------------------------------- diff --git a/source/getting-started/message-resource-files.md b/source/getting-started/message-resource-files.md index bac906b..60375d4 100644 --- a/source/getting-started/message-resource-files.md +++ b/source/getting-started/message-resource-files.md @@ -227,3 +227,5 @@ If we implement the same concept by creating _es.properties versions of `global. __Summary__ We've covered how to use message resources (resource bundles) in Struts 2 and also introduced how Struts 2 enables internationalization (i18n) in this tutorial. To fully understand these concepts and learn more about Struts 2 consult the main Struts 2 documentation available at [http://struts.apache.org](http://struts.apache.org). + +|Return to [Form validation](form-validation.html)|or|onward to [Exception handling](exception-handling.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/preperable-interface.md ---------------------------------------------------------------------- diff --git a/source/getting-started/preperable-interface.md b/source/getting-started/preperable-interface.md index 0571572..5508fcf 100644 --- a/source/getting-started/preperable-interface.md +++ b/source/getting-started/preperable-interface.md @@ -41,3 +41,5 @@ When you run the example application, look in the log to see when the prepare me __Summary__ When your application requires specific statements to be executed no matter which method of the Action class is called or when validation fails, you should implement the Preparable interface and override the prepare method. + +|Return to [HTTP Session](http-session.html)|or|onward to [Exclude Parameters](exclude-parameters.html)| \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/processing-forms.md ---------------------------------------------------------------------- diff --git a/source/getting-started/processing-forms.md b/source/getting-started/processing-forms.md index 27b52fc..7fbbb32 100644 --- a/source/getting-started/processing-forms.md +++ b/source/getting-started/processing-forms.md @@ -229,3 +229,5 @@ If everything is correct, you should be able to create the war file, deploy the Fill out the form and click the submit button. You should then see the thankyou.jsp page.  + +|Return to [Coding Struts 2 Actions](coding-actions.html)|or|onward to [Form validation](form-validation.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/spring.md ---------------------------------------------------------------------- diff --git a/source/getting-started/spring.md b/source/getting-started/spring.md index 3f3acde..3fe5803 100644 --- a/source/getting-started/spring.md +++ b/source/getting-started/spring.md @@ -132,3 +132,5 @@ In the `struts.xml`Â configuration file you must specify the Spring id value for __Summary__ In this tutorial we reviewed how to use the Struts 2 Spring plugin to integrate Spring and Struts. By using the Struts 2 Spring plugin you can have Spring manage the dependencies of your ActionSupport classes. Of course you can also take advantage of the many other benefits (AOP, Spring JDBC) that the Spring framework provides. + +|Return to [Themes](themes.html)|or|onward to [Annotations](annotations.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/themes.md ---------------------------------------------------------------------- diff --git a/source/getting-started/themes.md b/source/getting-started/themes.md index 15a785a..9ce11c6 100644 --- a/source/getting-started/themes.md +++ b/source/getting-started/themes.md @@ -144,3 +144,5 @@ __Summary__ You can easily override the default theme used by Struts 2 to control the appearance and layout of a Struts 2 tag. Each Struts 2 tag has an associated template file (e.g. `select.ftl`) that is in a folder named after the theme (e.g. xhtml). By default the Struts framework will look in the Struts 2 core Jar file for the theme folder and templates. However, if you include your own theme folder (e.g. KUTheme) under webapp/template (or WebContent/template in the Ant version) and specify that folder name (e.g. KUTheme) as the value for the theme attribute, then the Struts 2 framework will look in that theme folder for the tag's template. To learn more about how to use the Struts 2 themes and how you can override them, visit [Themes and Templates Documentation](//struts.apache.org/docs/themes-and-templates.html) . + +|Return to [Wildcard method selection](wildcard-method-selection.html)|or|onward to [Spring and Struts 2](spring.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/unit-testing.md ---------------------------------------------------------------------- diff --git a/source/getting-started/unit-testing.md b/source/getting-started/unit-testing.md index 0a9d8a8..d79f002 100644 --- a/source/getting-started/unit-testing.md +++ b/source/getting-started/unit-testing.md @@ -108,3 +108,5 @@ In the last assertEquals statement my test checks that the Struts 2 framework re __Summary__ There is much more you can do with the Struts 2 JUnit plugin to help you test the methods of your Action class in conjunction with the Struts 2 framemwork. If your Struts 2 application uses Spring to inject dependencies into the Action class then the Struts 2 JUnit Plugin has a StrutsSpringTestCase that your test class should extend. Please read [Testing Actions](//struts.apache.org/docs/testing-actions.html) to learn more. + +|Return to [Introducing Interceptors](introducing-interceptors.html)|or|onward to [HTTP Session](http-session.html)| \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/using-tags.md ---------------------------------------------------------------------- diff --git a/source/getting-started/using-tags.md b/source/getting-started/using-tags.md index 5189297..6837983 100644 --- a/source/getting-started/using-tags.md +++ b/source/getting-started/using-tags.md @@ -210,3 +210,5 @@ Since getMessageStore of HelloWorldAction class returns a MessageStore object, S  We covered a lot in this tutorial, but we've really only scratched the surface of how to use the Struts 2 tags. Consult the _Struts 2 Tag Reference_ for much more information about all the Struts 2 tags. + +|Return to [Hello World using Struts 2](hello-world-using-struts2.html)|or|onward to [Coding Struts 2 Actions](coding-actions.html)| http://git-wip-us.apache.org/repos/asf/struts-site/blob/ccdbffb9/source/getting-started/wildcard-method-selection.md ---------------------------------------------------------------------- diff --git a/source/getting-started/wildcard-method-selection.md b/source/getting-started/wildcard-method-selection.md index 277d950..fefbad5 100644 --- a/source/getting-started/wildcard-method-selection.md +++ b/source/getting-started/wildcard-method-selection.md @@ -74,3 +74,5 @@ The Struts 2 documentation also recommends turning off the option to use the dyn __Summary__ By using the wildcard method selection technique explained above, you can significantly reduce the number of action mapping nodes you need to write and manage in the Struts 2 XML configuration file. + +|Return to [Form validation using XML](form-validation-using-xml.html)|or|onward to [Themes](themes.html)|