You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2017/04/02 09:13:02 UTC

[01/13] struts-site git commit: cleaned up coding actions page

Repository: struts-site
Updated Branches:
  refs/heads/master efde95225 -> 30412c4dd


cleaned up coding actions page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/4322cf85
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/4322cf85
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/4322cf85

Branch: refs/heads/master
Commit: 4322cf858254448b51261ec169a5b2de82c4b986
Parents: efde952
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sat Apr 1 17:33:52 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sat Apr 1 17:33:52 2017 +0200

----------------------------------------------------------------------
 source/getting-started/coding-actions.md | 133 +++++++-------------------
 1 file changed, 37 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/4322cf85/source/getting-started/coding-actions.md
----------------------------------------------------------------------
diff --git a/source/getting-started/coding-actions.md b/source/getting-started/coding-actions.md
index 8a9b04a..8922e96 100644
--- a/source/getting-started/coding-actions.md
+++ b/source/getting-started/coding-actions.md
@@ -13,21 +13,18 @@ __Introduction__
 Coding a Struts 2 Action involves several parts:
 
 1. Mapping an action to a class
- 2. Mapping a result to a view
- 3. Writing the controller logic in the Action class
+2. Mapping a result to a view
+3. Writing the controller logic in the Action class
 
 In the previous tutorials we covered how to configure Struts to map a URL such as hello.action to a Action class such as HelloWorldAction (specifically the execute method).
 
 **Action Mapping**
 
-
-~~~~~~~
+```xml
 <action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute">
-	<result name="success">/HelloWorld.jsp</result>
+    <result name="success">/HelloWorld.jsp</result>
 </action>
-
-
-~~~~~~~
+```
 
 The Action mapping above also specified that if the execute method of class HelloWorldAction returns success then the view HelloWorld.jsp will be returned to the browser.
 
@@ -37,118 +34,69 @@ __Struts 2 Action Classes__
 
 Action classes act as the controller in the MVC pattern. Action classes respond to a user action, execute business logic (or call upon other classes to do that), and then return a result that tells Struts what view to render.
 
-Struts 2 Action classes usually extend the 
-
-~~~~~~~
-ActionSupport
-~~~~~~~
- class, which is provided by the Struts 2 framework. Class 
-
-~~~~~~~
-ActionSupport
-~~~~~~~
- provides default implementations for the most common actions (e.g. execute, input) and also implements several useful Struts 2 interfaces. When your Action class extends class 
+Struts 2 Action classes usually extend the `ActionSupport` class, which is provided by the Struts 2 framework. Class `ActionSupport` provides default implementations for the most common actions (e.g. execute, input) and also implements several useful Struts 2 interfaces. When your Action class extends class `ActionSupport` your class can either override the default implementations or inherit them.
 
-~~~~~~~
-ActionSupport
-~~~~~~~
- your class can either override the default implementations or inherit them.
-
-If you examine class HelloWorldAction from tutorial [Using Struts 2 Tags](#PAGE_14811875) you'll see that it extends class 
-
-~~~~~~~
-ActionSupport
-~~~~~~~
- and then overrides method execute.
+If you examine class HelloWorldAction from tutorial [Using Struts 2 Tags](using-tags.html) you'll see that it extends class `ActionSupport` and then overrides method execute.
 
 In method execute is where we placed what we want this controller to do in response to the hello.action.
 
 **Method execute of HelloWorldAction**
 
-
-~~~~~~~
+```java
 public String execute() throws Exception {
-		
-	messageStore = new MessageStore() ;
-		
-	helloCount++;
-		
-	return SUCCESS;
-
-}
+    messageStore = new MessageStore() ;
 
+    helloCount++;
 
-~~~~~~~
-
-
-> 
-
-> 
-
+    return SUCCESS;
+}
+```
 > Note that method execute declares it throws an Exception. We'll cover in a later tutorial how to configure Struts to handle any Exceptions thrown from the Action classes methods.
 
-> 
-
 __Processing Form Input In The Action Class__
 
-One of the most common responsibilities of the Action class is to process user input on a form and then make the result of the processing available to the view page. To illustrate this responsibility, let's say that on our view page, HelloWorld.jsp, we want
- to display a personal hello, such as "Hello Struts User Bruce."
+One of the most common responsibilities of the Action class is to process user input on a form and then make the result of the processing available to the view page. To illustrate this responsibility, let's say that on our view page, HelloWorld.jsp, we want to display a personal hello, such as "Hello Struts User Bruce."
 
-In the [Using Struts 2 Tags](#PAGE_14811875) example application we added a Struts 2 form to index.jsp.
+In the [Using Struts 2 Tags](using-tags.html) example application we added a Struts 2 form to index.jsp.
 
 **Struts 2 Form Tags**
 
-
-~~~~~~~
+```xml
 <s:form action="hello">
-
-	<s:textfield name="userName" label="Your name" />
-	
-	<s:submit value="Submit" />
-
+    <s:textfield name="userName" label="Your name" />
+    <s:submit value="Submit" />
 </s:form>
-
-
-
-~~~~~~~
+```
 
 Make a note of the value of the name attribute for the Struts 2 textfield tag, which is userName. When the user clicks on the submit button for the above form, the action hello will be executed (hello.action). The form field values will be posted to the Struts 2 Action class (HelloWorldAction). The Action class may automatically receive those form field values provided it has a public set method that matches the form field name value.
 
-So for the HelloWorldAction class to automatically receive the userName value it must have a public method setUserName (note the JavaBean convention discussed in tutorial [Hello World](#PAGE_14811871)).
+So for the HelloWorldAction class to automatically receive the userName value it must have a public method setUserName (note the JavaBean convention discussed in tutorial [Hello World](hello-world-using-struts2.html)).
 
 For the example application associated with this tutorial add the following Java code to class HelloWorldAction.
 
 **Add userName to HelloWorldAction**
 
+```java
+    private String userName;
 
-~~~~~~~
-	private String userName;
+    public String getUserName() {
+        return userName;
+    }
 
-	public String getUserName() {
-		return userName;
-	}
-
-	public void setUserName(String userName) {
-		this.userName = userName;
-	}
-
-
-~~~~~~~
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+```
 
 To personalize the MessageStore message (recall that class MessageStore is storing the message to display) add the following Java code to the HelloWorldAction's execute method after the statement that instantiates the MessageStore object.
 
 **Add userName value to message**
 
-
-~~~~~~~
-if (userName != null) {
-			
-	messageStore.setMessage( messageStore.getMessage() + " " + userName);
-			
-}
-
-
-~~~~~~~
+```java
+    if (userName != null) {
+        messageStore.setMessage( messageStore.getMessage() + " " + userName);
+    }
+```
 
 Now build and deploy the application. Enter your name in the form and click the submit button. You should see the following page.
 
@@ -156,22 +104,15 @@ Now build and deploy the application. Enter your name in the form and click the
 
 When the form is submitted, Struts will call any set methods of the HelloWorldAction class that match the form field names. So in this example method setUserName was called and passed the value the user entered in the userName form field.
 
-On the index.jsp we also have a Struts 2 action link (see tutorial [Using Struts 2 Tags](#PAGE_14811875)) that includes a query string parameter: userName=Bruce\+Phillips. If you click on that link you should see the result of:
+On the index.jsp we also have a Struts 2 action link (see tutorial [Using Struts 2 Tags](using-tags.html)) that includes a query string parameter: userName=Bruce+Phillips. If you click on that link you should see the result of:
 
 ![hellobruce.png](attachments/att14974997_hellobruce.png)
 
 Since the query string parameter is userName, Struts passed the value of that parameter to the setUserName method.
 
-
-> 
-
-> 
-
-> On the view page, HelloWorld.jsp, you can also access the userName value by using the Struts 2 property tag (see tutorial [Using Struts 2 Tags](#PAGE_14811875)). Try showing just the userName value on the view page.
-
-> 
+On the view page, HelloWorld.jsp, you can also access the userName value by using the Struts 2 property tag (see tutorial [Using Struts 2 Tags](using-tags.html)). Try showing just the userName value on the view page.
 
 __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 in our next tutorial will cover how to integrate a model class, form fields in the view, and form processing in the Action class.
+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.
 


[07/13] struts-site git commit: cleaned up debugging-struts page

Posted by lu...@apache.org.
cleaned up debugging-struts page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/a4163950
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/a4163950
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/a4163950

Branch: refs/heads/master
Commit: a4163950514267543f092ba6ea065bea54749554
Parents: e6a5ffd
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sat Apr 1 21:22:05 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sat Apr 1 21:22:05 2017 +0200

----------------------------------------------------------------------
 source/getting-started/debugging-struts.md | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/a4163950/source/getting-started/debugging-struts.md
----------------------------------------------------------------------
diff --git a/source/getting-started/debugging-struts.md b/source/getting-started/debugging-struts.md
index df3d03f..9c38375 100644
--- a/source/getting-started/debugging-struts.md
+++ b/source/getting-started/debugging-struts.md
@@ -10,11 +10,7 @@ __Introduction__
 
 During development of a Struts 2 web application you may want to view the information being managed by the Struts 2 framework. This tutorial will cover two tools you can use to see how Struts 2 views your web application. One tool is the Struts 2 configuration plugin and the other is the debugging interceptor. This article also discusses how to set the log level to see more or fewer log messages.
 
-
-
-| The Struts 2 [user mailing list](http://struts.apache.org/mail.html)^[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.
 
 __Configuration Plugin__
 
@@ -22,11 +18,9 @@ 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>
-
-~~~~~~~
+```
 
 In the example application, there is a link to the configuration browser on the index.jsp page.
 
@@ -44,14 +38,9 @@ On the left side of the page is the config browser plugin menu. Clicking on cons
 
 __Using the Debugging Interceptor__
 
-If you have set 
-
-~~~~~~~
-devMode
-~~~~~~~
- to true (in the example application see struts.xml) then one of the interceptors that is activated when Struts 2 processes an action is the DebuggingInterceptor. The DebuggingInterceptor looks for a query string appended to the action URL with a name of debug and a value of xml, console, command, or browser.
+If you have set `devMode` to true (in the example application see `struts.xml`) then one of the interceptors that is activated when Struts 2 processes an action is the DebuggingInterceptor. The DebuggingInterceptor looks for a query string appended to the action URL with a name of debug and a value of xml, console, command, or browser.
 
-If the DebuggingInterceptor finds that query string then it will halt further execution of the action and instead return to the browser debugging information. The format of the returned information depends on the value of the debug query parameter. See _DebuggingInterceptor_  for more detail.
+If the DebuggingInterceptor finds that query string then it will halt further execution of the action and instead return to the browser debugging information. The format of the returned information depends on the value of the debug query parameter. See [DebuggingInterceptor](//struts.apache.org/docs/debugginginterceptor.html)  for more detail.
 
 In the example application on the index.jsp is a link for displaying debugging information. This link includes the query string debug=browser. If you click on this link you'll see a table with columns that can be expanded and collapsed. The table contains the various objects and their state being managed by the Struts 2 framework.
 
@@ -61,7 +50,7 @@ Note that to enable the correct display and interaction of the expand/collapse l
 
 __Struts 2 Logging__
 
-The Struts 2 framework will write to a log a great deal of information if you've configured the log properties to log at the debug level. In the example application, view log4j.xml. The two major packages involved in the Struts 2 framework, com.opensymphony and org.apache.struts2, are configured to write debug and above log messages. When you run the application view the standard out for your Servlet container to see all the information written to the log. Please check _Logging_  page for other options.
+The Struts 2 framework will write to a log a great deal of information if you've configured the log properties to log at the debug level. In the example application, view `log4j.xml`. The two major packages involved in the Struts 2 framework, `com.opensymphony` and `org.apache.struts2`, are configured to write debug and above log messages. When you run the application view the standard out for your Servlet container to see all the information written to the log. Please check [Logging](//struts.apache.org/docs/logging.html)  page for other options.
 
 __Summary__
 


[06/13] struts-site git commit: cleaned exception-handling page

Posted by lu...@apache.org.
cleaned exception-handling page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/e6a5ffd8
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/e6a5ffd8
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/e6a5ffd8

Branch: refs/heads/master
Commit: e6a5ffd8547e34b2c9cdbb3b08ad4e81987fb7e2
Parents: bb095a3
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sat Apr 1 21:10:52 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sat Apr 1 21:10:52 2017 +0200

----------------------------------------------------------------------
 source/getting-started/exception-handling.md | 82 +++++++++--------------
 1 file changed, 31 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/e6a5ffd8/source/getting-started/exception-handling.md
----------------------------------------------------------------------
diff --git a/source/getting-started/exception-handling.md b/source/getting-started/exception-handling.md
index 8951ac5..6a08993 100644
--- a/source/getting-started/exception-handling.md
+++ b/source/getting-started/exception-handling.md
@@ -6,100 +6,82 @@ title: Exception handling
 
 The code for this tutorial, exception_handling, is available for checkout at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
 
-> 
-
-#####Introduction#####
+__Introduction__
 
 In this tutorial we'll explore how to enable the Struts 2 framework to handle any uncaught exceptions generated by a web application. Struts 2 provides robust exception handling, including the ability to automatically log any uncaught exceptions and redirect the user to a error web page.
 
+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)^[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.
-
-| 
-
-#####Global Exception Handling#####
+__Global Exception Handling__
 
 Using the Struts 2 framework you can specify in the struts.xml how the framework should handle uncaught exceptions. The handling logic can apply to all actions (global exception handling) or to a specific action. Let's first discuss how to enable global exception handling.
 
-To enable global exception handling you need to add two nodes to struts.xml: global-exception-mapping and global-results. For example examine struts.xml from the exception_handling project.
+To enable global exception handling you need to add two nodes to `struts.xml`: `global-exception-mapping` and `global-results`. For example examine the `struts.xml` from the exception_handling project.
 
-
-~~~~~~~
-  
-   <global-results>
+```xml
+    <global-results>
         <result name="securityerror">/securityerror.jsp</result>
   	<result name="error">/error.jsp</result>
-   </global-results>
+    </global-results>
 
-   <global-exception-mappings>
+    <global-exception-mappings>
 	<exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" result="securityerror" />
 	 <exception-mapping exception="java.lang.Exception" result="error" />
-   </global-exception-mappings>
-  
-
-~~~~~~~
+    </global-exception-mappings>
+```
 
 The global exception mapping node tells the Struts 2 framework what to do if an uncaught exception of the type specified (or a child of that type) is thrown by the the application. For example if a SecurityBreachException is thrown but not caught, the Struts 2 Action class will return a result of "securityerror". All other uncaught exceptions will cause the Struts 2 Action class to return a result of "error".
 
 The global results mapping node relates the result value to a specific view page. For example the result "securityerror" will cause the framework to redirect the user's browser to the securityerror.jsp view page.
 
-#####Exception Handling Per Action#####
+__Exception Handling Per Action__
 
 If you need to handle an exception in a specific way for a certain action you can use the exception-mapping node within the action node.
 
-
-~~~~~~~
+```xml
    <action name="actionspecificexception" class="org.apache.struts.register.action.Register" method="throwSecurityException">
-     <exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" 
-          result="login" />
+      <exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" result="login" />
       <result>/register.jsp</result>
       <result name="login">/login.jsp</result>
    </action>
+```
 
-
-~~~~~~~
-
-The above action node from the example application's struts.xml file specifies that if method throwSecurityException throws an uncaught exception of type SecurityBreachException the Struts 2 framework should return a result of login. The login result will cause the user's browser to be redirected to login.jsp.
+The above action node from the example application's struts.xml file specifies that if the method `throwSecurityException` throws an uncaught exception of type `SecurityBreachException` the Struts 2 framework should return a result of login. The login result will cause the user's browser to be redirected to login.jsp.
 
 You can see that an action-specific exception mapping will take precedence if the same exception is also mapped globally.
 
-#####Logging Exceptions#####
+__Logging Exceptions__
 
-You can configure the Struts 2 framework to log any uncaught exceptions. To enable logging of the exceptions being handled by the Struts 2 framework you must specify some parameter values in struts.xml. If you examine the [ExceptionMappingInterceptor class API](http://struts.apache.org/release/2.3.x/xwork-core/apidocs/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.html)^[http://struts.apache.org/release/2.3.x/xwork-core/apidocs/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.html] there are three parameter values you can set to enable logging (logEnabled), the log level to use (logLevel), and the log category (logCategory) to specify in the log message.
+You can configure the Struts 2 framework to log any uncaught exceptions. To enable logging of the exceptions being handled by the Struts 2 framework you must specify some parameter values in struts.xml. If you examine the [ExceptionMappingInterceptor class API](https://struts.apache.org/maven/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.html) there are three parameter values you can set to enable logging (logEnabled), the log level to use (logLevel), and the log category (logCategory) to specify in the log message.
 
 To set these parameter values for all actions that use a specific stack of interceptors in a package include the following in struts.xml just after the opening package node.
 
-
-~~~~~~~
+```xml
 <interceptors>
-  <interceptor-stack name="appDefaultStack">
-    <interceptor-ref name="defaultStack">
-     <param name="exception.logEnabled">true</param>
-     <param name="exception.logLevel">ERROR</param>
-    </interceptor-ref>
- </interceptor-stack>
+    <interceptor-stack name="appDefaultStack">
+        <interceptor-ref name="defaultStack">
+            <param name="exception.logEnabled">true</param>
+            <param name="exception.logLevel">ERROR</param>
+        </interceptor-ref>
+    </interceptor-stack>
 </interceptors>
 
 <default-interceptor-ref name="appDefaultStack" />
+```
 
-
-~~~~~~~
-
-The above interceptors node configures a new stack of Struts 2 interceptors named appDefaultStack. This stack of interceptors is based upon the defaultStack of interceptors (which are the Struts 2 interceptors that execute by default whenever an Action class method is called by the Struts 2 framework).
+The above interceptors node configures a new stack of Struts 2 interceptors named `appDefaultStack`. This stack of interceptors is based upon the defaultStack of interceptors (which are the Struts 2 interceptors that execute by default whenever an Action class method is called by the Struts 2 framework).
 
 The ExceptionMappingInterceptor is one of the Struts 2 interceptors that is part of the default stack. In the definition of the struts defaultStack, the ExceptionMappingInterceptor is given the name of exception. By specifying a param node with the name of exception.logEnabled and a value of true, I'm setting the logEnabled parameter of the ExceptionMappingInterceptor class to true.
 
 Now when the application throws an uncaught exception, the Struts 2 framework will handle it and will also write an entry to the log that includes the stack trace. In the example above, I've set the level to log these exceptions to be ERROR.
 
-In the example applications, the logging is just to the Servlet container's console (see the log4j.xml file for the log settings).
+In the example applications, the logging is just to the Servlet container's console (see the `log4j.xml` file for the log settings).
 
-#####Display Exception Information In Browser#####
+__Display Exception Information In Browser__
 
 You can display information about the exception in the browser if you want by using s:property tags with a value of exception and exceptionStack. For example in error.jsp is this markup.
 
-
-~~~~~~~
+```html
    <h4>The application has malfunctioned.</h4>
 
    <p>  Please contact technical support with the following information:</p> 
@@ -107,12 +89,10 @@ You can display information about the exception in the browser if you want by us
    <h4>Exception Name: <s:property value="exception" /> </h4>
 
    <h4>Exception Details: <s:property value="exceptionStack" /></h4> 
-
-
-~~~~~~~
+```
 
 When the exception interceptor is triggered it adds to the fields available for display the exception message and the exception's stack trace.
 
-#####Summary#####
+__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.


[10/13] struts-site git commit: cleaned up control-tags page

Posted by lu...@apache.org.
cleaned up control-tags page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/9ee4d154
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/9ee4d154
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/9ee4d154

Branch: refs/heads/master
Commit: 9ee4d15426f1d903708db0b3516a72f953867137
Parents: 4d57b53
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sun Apr 2 09:50:47 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sun Apr 2 09:50:47 2017 +0200

----------------------------------------------------------------------
 source/getting-started/control-tags.md | 62 +++++++++++------------------
 1 file changed, 24 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/9ee4d154/source/getting-started/control-tags.md
----------------------------------------------------------------------
diff --git a/source/getting-started/control-tags.md b/source/getting-started/control-tags.md
index eb8e54e..edcc083 100644
--- a/source/getting-started/control-tags.md
+++ b/source/getting-started/control-tags.md
@@ -6,34 +6,26 @@ title: Control tags
 
 The example code for this tutorial, control_tags, is available at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples)
 
-> 
+__Introduction__
 
-#####Introduction#####
+Struts 2 has several control tags that can be used in the view. This tutorial will discuss and show examples of how to use the Struts 2 if and iterator tags. For more information about these and other control tags visit [tags reference](http://cwiki.apache.org/confluence/display/WW/Generic+Tag+Reference).
 
-Struts 2 has several control tags that can be used in the view. This tutorial will discuss and show examples of how to use the Struts 2 if and iterator tags. For more information about these and other control tags visit [tags reference](http://cwiki.apache.org/confluence/display/WW/Generic\+Tag\+Reference)^[http://cwiki.apache.org/confluence/display/WW/Generic\+Tag\+Reference].
+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)^[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.
-
-| 
-
-#####Struts 2 if Tag#####
+__Struts 2 if Tag__
 
 In the example application's thankyou.jsp is this markup.
 
 **thankyou.jsp Struts if Tag**
 
-
-~~~~~~~
+```html
 <s:if test="personBean.over21">
     <p>You are old enough to vote!</p>
 </s:if>
 <s:else>
    <p>You are NOT old enough to vote.</p>
 </s:else>
-
-~~~~~~~
+```
 
 The Struts if tag has a test attribute. The value of the test attribute must evaluate to true or false. If true the statements between the opening and closing s:if tags will be executed. If false, the statements between the opening and closing s:else tags will be executed. Note that s:else tags come after the closing s:if tag and that the s:else tags are not required.
 
@@ -41,53 +33,47 @@ In the above example the Struts framework will call method getPersonBean exposed
 
 The value of the test attribute must be an expression that evaluates to true or false, but doesn't need to be a method call that returns a boolean. For example this s:if tag that is in thankyou.jsp has a more complicated expression.
 
-
-~~~~~~~
+```html
 <s:if test="personBean.carModels.length > 1">
-	<p>Car models
+    <p>Car models
 </s:if>
 <s:else>
    <p>Car model
 </s:else>
-
-~~~~~~~
+```
 
 The purpose of the above markup is to use either "Car model" or "Car models" depending on how many car models the user selected on the edit page. So the value for the test attribute of this iterator tag gets the length of the carModels String array and compares that to 1. If it's greater then 1, the correct grammar is "Car models" else the correct grammar is "Car model".
 
-#####Struts iterator Tag#####
+__Struts iterator Tag__
 
 The Struts iterator tag is used to generate a loop that iterates over each item in a collection. In the thankyou.jsp is this markup.
 
-
-~~~~~~~
+```html
 <table style="margin-left:15px">
-	<s:iterator value="personBean.carModels">
-		<tr><td><s:property /></td></tr>
-	</s:iterator>
+    <s:iterator value="personBean.carModels">
+        <tr><td><s:property /></td></tr>
+    </s:iterator>
 </table>
-
-~~~~~~~
+```
 
 The goal of this code is to create an HTML table with a row that display a car model selected by the user on the edit page. The car models the user selects on the edit page are stored in the carModels field (a String array) of the personBean object (of class Person).
 
 The iterator tag has a value attribute that must evaluate to a collection (Array, List, Map).
 
-The s:property tag nested inside the iterator tag is used to display the specific value of the collection each time the iterator loops over an element of the collection. Since the collection is an Array of String objects, the s:property tag doesn't need to specify a value attribute. By default the s:property tag will display the single String for that element of the collection.
+The `s:property` tag nested inside the iterator tag is used to display the specific value of the collection each time the iterator loops over an element of the collection. Since the collection is an Array of String objects, the `s:property` tag doesn't need to specify a value attribute. By default the `s:property` tag will display the single String for that element of the collection.
 
 If the collection contains objects that have multiple fields, then you should use the value attribute of the s:property tag to determine what field to display. For example:
 
-
-~~~~~~~
+```html
 <table style="margin-left:15px">
-	<s:iterator value="states" >	
-		<tr><td><s:property value="stateAbbr" /></td> <td><s:property value="stateName" /></tr>
-	</s:iterator>
+    <s:iterator value="states" >	
+        <tr><td><s:property value="stateAbbr" /></td> <td><s:property value="stateName" /></tr>
+    </s:iterator>
 </table>
+```
 
-~~~~~~~
-
-The value of the iterator tag is states, which causes the Struts 2 framework to call the getStates method of the Action class (EditAction.java). The getStates method returns a List of State objects. The State class has two fields stateAbbr and stateName, both having the appropriate get method. The iterator will loop over each State object stored in the collection. Each time through the loop, the Struts 2 framework will have a reference to the current State object and will call getStateAbbr and getStateName methods for that current State object.
+The value of the iterator tag is states, which causes the Struts 2 framework to call the getStates method of the Action class (`EditAction.java`). The getStates method returns a List of State objects. The State class has two fields stateAbbr and stateName, both having the appropriate get method. The iterator will loop over each State object stored in the collection. Each time through the loop, the Struts 2 framework will have a reference to the current State object and will call getStateAbbr and getStateName methods for that current State object.
 
-#####Additional Iterator Attributes#####
+__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)^[https://cwiki.apache.org/confluence/display/WW/iterator] for more information.
+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.


[08/13] struts-site git commit: cleaned up the form-tags page

Posted by lu...@apache.org.
cleaned up the form-tags page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/338b55ff
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/338b55ff
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/338b55ff

Branch: refs/heads/master
Commit: 338b55ff63f74defb3bc773ff0038141a9b4aeb5
Parents: a416395
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sun Apr 2 09:03:10 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sun Apr 2 09:03:10 2017 +0200

----------------------------------------------------------------------
 source/getting-started/form-tags.md | 103 +++++++++----------------------
 1 file changed, 30 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/338b55ff/source/getting-started/form-tags.md
----------------------------------------------------------------------
diff --git a/source/getting-started/form-tags.md b/source/getting-started/form-tags.md
index fd36cc4..baa7bcc 100644
--- a/source/getting-started/form-tags.md
+++ b/source/getting-started/form-tags.md
@@ -6,19 +6,13 @@ title: Form tags
 
 The example code for this tutorial, form_tags, can be checked out from [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
 
-> 
+__Introduction__
 
-#####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_ , _Form Validation_ , and _Message Resource Files_ ) 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)^[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#####
+__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.
 
@@ -30,30 +24,20 @@ The form allows the user to make changes. After submitting the form, the Struts
 
 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#####
+__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.
 
 **Struts 2 Select Tag**
 
-
-~~~~~~~
+```html
 <s:select key="personBean.sport" list="sports" />
+```
 
-
-~~~~~~~
-
-In these form tags, we are using the key attribute as discussed in the _Message Resource Files_  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_  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.
 
-> 
-
 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".
@@ -62,8 +46,7 @@ Here is the HTML that results from using the above Struts 2 select tag.
 
 **HTML Created By Struts 2 Select Tag**
 
-
-~~~~~~~
+```html
 <tr>
 <td class="tdLabel">
 <label for="save_personBean_sport" class="label">Favorite sport:</label>
@@ -76,33 +59,27 @@ Here is the HTML that results from using the above Struts 2 select tag.
 </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.
 
 Since the personBean's getSport method returns "baskeball", the basketball option value is marked as selected.
 
-#####Struts 2 Radio Tag#####
+__Struts 2 Radio Tag__
 
 The Struts 2 radio tag\u2014like its standard HTML counterpart\u2014is 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**
 
-
-~~~~~~~
+```html
 <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.
 
 **HTML Created By Struts 2 Radio Tag**
 
-
-~~~~~~~
+```html
 <tr>
 <td class="tdLabel">
 <label for="save_personBean_gender" class="label">Gender:</label></td>
@@ -112,24 +89,19 @@ Again the key attribute's value determines the value for the label and value att
 <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.
 
-#####Struts 2 Select Tag - Object Backed#####
+__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
 
 **Struts 2 Select Tag Object Backed**
 
-
-~~~~~~~
+```html
 <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.
 
@@ -137,8 +109,7 @@ The listKey attribute tells the framework to use the value returned by calling t
 
 **HTML Created By Struts 2 Select Tag**
 
-
-~~~~~~~
+```html
 <tr>
 <td class="tdLabel">
 <label for="save_personBean_residency" class="label">State resident:</label></td>
@@ -152,31 +123,25 @@ The listKey attribute tells the framework to use the value returned by calling t
 </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.
 
-#####Struts 2 Checkbox Tag#####
+__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.
 
 **Struts 2 Checkbox Tag**
 
-
-~~~~~~~
+```html
 <s:checkbox key="personBean.over21" />
-
-
-~~~~~~~
+```
 
 Since the method getOver21 returns true, the checkbox is checked.
 
 **HTML Created By Struts 2 Checkbox Tag**
 
-
-~~~~~~~
+```html
 <tr>
 <td valign="top" align="right">
 </td>
@@ -185,15 +150,13 @@ Since the method getOver21 returns true, the checkbox is checked.
 <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\u2014given that the check box was not checked\u2014the 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.
 
-#####Struts 2 checkboxlist Tag#####
+__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.
 
@@ -201,12 +164,9 @@ Using the Struts 2 checkbox tag, we can create a series of checkboxes, one for e
 
 **Struts 2 Checkboxlist Tag**
 
-
-~~~~~~~
+```html
 <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).
 
@@ -214,8 +174,7 @@ The key attribute value in the checkboxlist tag tells the Struts 2 framework whi
 
 **HTML Created By Struts 2 Checkboxlist Tag**
 
-
-~~~~~~~
+```html
 <tr>
 <td class="tdLabel">
 <label for="save_personBean_carModels" class="label">Car models owned:</label></td>
@@ -231,9 +190,7 @@ The key attribute value in the checkboxlist tag tells the Struts 2 framework whi
 <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).


[05/13] struts-site git commit: cleaned up message-resource-files page

Posted by lu...@apache.org.
cleaned up message-resource-files page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/bb095a3f
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/bb095a3f
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/bb095a3f

Branch: refs/heads/master
Commit: bb095a3f489fd9d3ee5d1519f54a475fda7a17b0
Parents: d7ba877
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sat Apr 1 20:51:52 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sat Apr 1 20:51:52 2017 +0200

----------------------------------------------------------------------
 .../getting-started/message-resource-files.md   | 154 +++++++------------
 1 file changed, 57 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/bb095a3f/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 468bc65..bac906b 100644
--- a/source/getting-started/message-resource-files.md
+++ b/source/getting-started/message-resource-files.md
@@ -4,112 +4,94 @@ title: Message Resource Files
 ---
 ## Message Resource Files
 
-This tutorial assumes you've completed the _Form Validation_  tutorial and have a working form_validation project. The example code for this tutorial, message_resource, is available for checkout from the 
+This tutorial assumes you've completed the [Form Validation](form-validation.html) tutorial and have a working form_validation project. The example code for this tutorial, message_resource, is available for checkout from the 
 
->  Struts 2 GitHub repository at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
-
-> 
+Struts 2 GitHub repository at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
 
 __Introduction__
 
 In this tutorial we'll explore using Struts 2 message resource capabilities (also called resource bundles). Message resources provide a simple way to put text in a view page that is the same through out your application, to create form field labels, and to change text to a specific language based on the user's locale (i18n).
 
-
-
-| The [Struts 2 user mailing list](http://struts.apache.org/mail.html)^[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.
 
 __Message Resource Property Files__
 
 In a Struts 2 web application you may associate a message resource property file with each Struts 2 Action class by creating a properties file with the same name as the Action class and having the .properties extension. This properties file must go in the same package as the Action class. For our tutorial example, let's say we want to place the form field labels into a separate file where we can easily change them and also provide the capability to display the labels in other languages.
 
-If you're doing this tutorial after completing _Form Validation_  then you can make these changes to that tutorial's example application.
+If you're doing this tutorial after completing [Form Validation](form-validation.html) then you can make these changes to that tutorial's example application.
 
 Put the text below in a file named Register.properties in the org.apache.struts.register.action package in the src/resources/java folder.
 
 **Register.properties**
 
-
-~~~~~~~
+```
 personBean.firstName=First name
 personBean.lastName=Last name
 personBean.age=Age
 personBean.email=Email
 thankyou=Thank you for registering %{personBean.firstName}.
-
-~~~~~~~
+```
 
 The above is just a standard Java properties file. The key is to the left of the = sign and the value for the key is to the right. When the Register action is executed these properties will be available to the view page by referencing the key name.
 
 __Struts 2 Key Attribute__
 
-The Struts 2 key attribute can be used in the _textfield_  tag to instruct the framework what value to use for the textfield's name and label attributes. Instead of providing those attributes and their values directly, you can just use the key attribute.
+The Struts 2 key attribute can be used in the [textfield](//struts.apache.org/docs/textfield.html) tag to instruct the framework what value to use for the textfield's name and label attributes. Instead of providing those attributes and their values directly, you can just use the key attribute.
 
-If you open register.jsp from the _Form Validation_  tutorial you'll see this Struts 2 textfield tag:
+If you open register.jsp from the [Form Validation](form-validation.html) tutorial you'll see this Struts 2 textfield tag:
 
 **textfield tag**
 
-
-~~~~~~~
+```html
 <s:textfield name="personBean.firstName" label="First name" />
-
-~~~~~~~
+```
 
 Instead of specifying the name and label attributes you can just use the key attribute.
 
 **textfield tag with key attribute**
 
-
-~~~~~~~
+```html
 <s:textfield key="personBean.firstName"  />
-
-~~~~~~~
+```
 
 The value for the key attribute instructs the Struts 2 framework to use the same value for the name attribute (personBean.firstName). For the label attribute's value the value of the key attribute is used by the Struts 2 framework to find a key in a properties file with the same value. So in our example, Struts 2 will look in Register.properties for a key with a value of personBean.firstName. The value of that key (First name) will be used as the label attribute's value.
 
-To enable the key attribute to find the properties file, the display of the view page must be the result of executing a Struts 2 Action class. Right now if you examine index.jsp from the _Form Validation_  tutorial the link to the register.jsp page is a standard URL.
+To enable the key attribute to find the properties file, the display of the view page must be the result of executing a Struts 2 Action class. Right now if you examine index.jsp from the [Form Validation](form-validation.html) tutorial the link to the register.jsp page is a standard URL.
 
 **link to register.jsp**
 
-
-~~~~~~~
+```html
 <p><a href="register.jsp">Please register</a> for our prize drawing.</p>
-
-~~~~~~~
+```
 
 We need to change the above link so that it goes through the Register.java Struts 2 Action class. Replace the above with this markup.
 
 **link to Register Action class**
 
-
-~~~~~~~
+```html
 <s:url action="registerInput" var="registerInputLink" />
 <p><a href="${registerInputLink}">Please register</a> for our prize drawing.</p>
-
-~~~~~~~
+```
 
 We use the Struts 2 url tag to create a link to action registerInput. We then use that link as the value for the href attribute of the anchor tag. We must define the registerInput action in struts.xml. Add the following to struts.xml.
 
 **registerInput action node for struts.xml**
 
-
-~~~~~~~
-<action name="registerInput" class="org.apache.struts.register.action.Register" method="input" >
-	<result name="input">/register.jsp</result>
-</action>
-
-~~~~~~~
+```xml
+    <action name="registerInput" class="org.apache.struts.register.action.Register" method="input" >
+        <result name="input">/register.jsp</result>
+    </action>
+```
 
 The above action node instructs the Struts 2 framework to execute class Register's input method in response to action registerInput. The input method is inherited by class Register from class ActionSupport. The default behavior of the inherited input method is to return the String input. The result node above specifies that if the returned result is "input" then render the view register.jsp.
 
-By doing the above the view page register.jsp will have access to the properties defined in Register.properties. The Struts 2 framework will make those properties defined in Register.properties available to the view page since the view page was rendered after Register.java (the Struts 2 Action class) was executed.
+By doing the above the view page register.jsp will have access to the properties defined in `Register.properties`. The Struts 2 framework will make those properties defined in `Register.properties` available to the view page since the view page was rendered after Register.java (the Struts 2 Action class) was executed.
 
 Follow the instructions (README.txt) in the project to create the war file and copy the war file to your servlet container. Open a web browser and navigate to the home page specified in the README.txt file (index.action). You should see a link to registerInput.action when mousing over the hyperlink Please Register.
 
 ![registerInput.png](attachments/att14975007_registerInput.png)
 
-When you click on the Please Register link your browser should display the register.jsp. The form field labels should be the key values from the Register.properties file.
+When you click on the Please Register link your browser should display the register.jsp. The form field labels should be the key values from the `Register.properties` file.
 
 ![register.png](attachments/att14975006_register.png)
 
@@ -119,11 +101,9 @@ We can also use the Struts 2 text tag to display values from a properties file.
 
 **text tag**
 
-
-~~~~~~~
+```html
 <h3><s:text name="thankyou" /></h3>
-
-~~~~~~~
+```
 
 Since thankyou.jsp is also rendered after executing the Register.java Action class, the key thankyou and its value will be available to the view page.
 
@@ -133,13 +113,11 @@ How did the value entered for the first name input field get displayed on thanky
 
 **Register.properties**
 
-
-~~~~~~~
+```
 thankyou=Thank you for registering %{personBean.firstName}.
+```
 
-~~~~~~~
-
-The markup %\{personBean.firstName\} tells Struts 2 to replace this part with the result of calling getPersonBean, which returns a Person object. Then call the getFirstName method which returns a String (the value the user inputted into the personBean.firstName form field on register.jsp).
+The markup `%{personBean.firstName}` tells Struts 2 to replace this part with the result of calling getPersonBean, which returns a Person object. Then call the getFirstName method which returns a String (the value the user inputted into the personBean.firstName form field on register.jsp).
 
 __Package Level Properties__
 
@@ -149,21 +127,17 @@ Place the following in a file named package.properties and save that file in pac
 
 **package.properties**
 
-
-~~~~~~~
+```
 greeting=Welcome to The Wonderful World of Struts 2
-
-~~~~~~~
+```
 
 Now any view rendered by an Action that is in the hierarchy org.apache.struts... can use a Struts 2 text tag with a name attribute value of "greeting" to display the value of the greeting property key. For example add the following markup to helloworld.jsp before the h2 tag.
 
 **Using properties set in package.properties**
 
-
-~~~~~~~
+```html
 <h1><s:text name="greeting" /></h1>
-
-~~~~~~~
+```
 
 Then rebuild the war file and deploy it to your servlet container. Go to index.action and click on the link for Hello World. You should see:
 
@@ -173,17 +147,15 @@ The property keys and values defined in package.properties are available to any
 
 __Global Properties__
 
-You can also specify a global property file in struts.xml. The keys and values defined in that property file will be available to all the view pages that are rendered after executing an Action class.
+You can also specify a global property file in `struts.xml`. The keys and values defined in that property file will be available to all the view pages that are rendered after executing an Action class.
 
-Add the following to a file named global.properties (note the name doesn't have to be global).
+Add the following to a file named `global.properties` (note the name doesn't have to be global).
 
 **global.properties**
 
-
-~~~~~~~
+```
 contact=For assistance contact <a href='mailto:contact@email.com'>contact@email.com</a>
-
-~~~~~~~
+```
 
 Save the global.properties file in the src/main/resources folder.
 
@@ -191,22 +163,18 @@ To inform the Struts 2 framework about the global.properties file add the follow
 
 **Specify Global Property File In struts.xml**
 
-
-~~~~~~~
+```xml
 <constant name="struts.custom.i18n.resources" value="global" />
-
-~~~~~~~
+```
 
 To use the contact key in a view page, add the following markup to index.jsp just before the closing body tag.
 
 **Using contact property**
 
-
-~~~~~~~
-<hr />
-<s:text name="contact" />
-
-~~~~~~~
+```html
+    <hr />
+    <s:text name="contact" />
+```
 
 Rebuild the war file, deploy it to your Servlet container, and then go to index.action. You should see:
 
@@ -218,51 +186,43 @@ You can add the text tag above to all the JSPs in this example.
 
 __Internationalization (i18n)__
 
-Using message resource files (resource bundles) also enables you to provide text in different languages. By default, Struts 2 will use the user's default locale. If that locale is en for English then the property files used will be the ones without a locale specification (for example Register.properties). If the locale is not English but say Spanish (es) then Struts 2 will look for a properties file named Register_es.properties.
+Using message resource files (resource bundles) also enables you to provide text in different languages. By default, Struts 2 will use the user's default locale. If that locale is en for English then the property files used will be the ones without a locale specification (for example `Register.properties`). If the locale is not English but say Spanish (es) then Struts 2 will look for a properties file named `Register_es.properties`.
 
-To provide an example of Struts 2 support for i18n create a file named Register_es.properties and in that file add the following Spanish translations.
+To provide an example of Struts 2 support for i18n create a file named `Register_es.properties` and in that file add the following Spanish translations.
 
 **Register_es.properties**
 
-
-~~~~~~~
+```
 personBean.firstName=Nombre
 personBean.lastName=Apellidos
 personBean.age=Edad
 personBean.email=Correo
 thankyou=Gracias por registrarse, %{personBean.firstName}. 
-
-~~~~~~~
-
-
+```
 
 | My apologies to Spanish language speakers for any mistakes in the Spanish translations.
 
-| 
-
-Save the Register_es.properties file in the same package as Register.properties.
+Save the `Register_es.properties` file in the same package as `Register.properties`.
 
 In our example application, we need to tell Struts 2 to use a locale value of es (since we're not in a Spanish locale) instead of the default locale value of our location (which is en). Add the following markup to index.jsp.
 
 **Specify The Locale As a URL Parameter**
 
+```html
+    <h3>Registro espa�ol</h3>
+    <s:url action="registerInput" var="registerInputLinkES">
+        <s:param name="request_locale">es</s:param>
+    </s:url>
+    <p><a href="${registerInputLinkES}">Por favor, reg�strese</a> para nuestro sorteo</p>
+```
 
-~~~~~~~
-<h3>Registro espa�ol</h3>
-<s:url action="registerInput" var="registerInputLinkES">
-    <s:param name="request_locale">es</s:param>
-</s:url>
-<p><a href="${registerInputLinkES}">Por favor, reg�strese</a> para nuestro sorteo</p>
-
-~~~~~~~
-
-In the above markup we've added a parameter named request_locale to the URL. The value of that parameter is es. The Action class that responds to this URL (Register.java) will see that the locale is es and will look for property files with _es (for example Register_es.properties). It will use those property files to find the values of the property keys referenced by the view page (e.g. personBean.firstName).
+In the above markup we've added a parameter named request_locale to the URL. The value of that parameter is es. The Action class that responds to this URL (Register.java) will see that the locale is es and will look for property files with _es (for example `Register_es.properties`). It will use those property files to find the values of the property keys referenced by the view page (e.g. personBean.firstName).
 
 After clicking on the above link you should see the same form as before but with the form field labels in Spanish.
 
 ![spanishform.png](attachments/att14975008_spanishform.png)
 
-If we implement the same concept by creating _es.properties versions of global.properties (global_es.properties) and package.properties (package_es.properties) then we can create a complete registration web page in Spanish. Download the finished example application for this tutorial from Google Code - [http://code.google.com/p/struts2-examples/downloads/list](http://code.google.com/p/struts2-examples/downloads/list) to see those property files and run the complete example with the registration form in Spanish.
+If we implement the same concept by creating _es.properties versions of `global.properties` (`global_es.properties`) and `package.properties` (`package_es.properties`) then we can create a complete registration web page in Spanish. Download the finished example application for this tutorial from Google Code - [http://code.google.com/p/struts2-examples/downloads/list](http://code.google.com/p/struts2-examples/downloads/list) to see those property files and run the complete example with the registration form in Spanish.
 
 __Summary__
 


[02/13] struts-site git commit: cleaned up processing forms page

Posted by lu...@apache.org.
cleaned up processing forms page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/1454da1d
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/1454da1d
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/1454da1d

Branch: refs/heads/master
Commit: 1454da1df367e271a3e8bb74393f34dbbe7d6deb
Parents: 4322cf8
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sat Apr 1 18:02:07 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sat Apr 1 18:02:07 2017 +0200

----------------------------------------------------------------------
 source/getting-started/processing-forms.md | 185 ++++++++++--------------
 1 file changed, 73 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/1454da1d/source/getting-started/processing-forms.md
----------------------------------------------------------------------
diff --git a/source/getting-started/processing-forms.md b/source/getting-started/processing-forms.md
index 585f29e..909a8a9 100644
--- a/source/getting-started/processing-forms.md
+++ b/source/getting-started/processing-forms.md
@@ -4,7 +4,7 @@ title: Processing forms
 ---
 ## Processing Forms
 
-This tutorial assumes you've completed the _Coding Struts 2 Actons_  tutorial and have a working coding_actions project. The example code for this tutorial, form_processing, is available for checkout from the Struts 2 GitHub subversion repository: [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
+This tutorial assumes you've completed the [Coding Struts 2 Actons](coding-actions.html) tutorial and have a working coding_actions project. The example code for this tutorial, form_processing, is available for checkout from the Struts 2 GitHub subversion repository: [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
 
 > 
 
@@ -12,80 +12,63 @@ __Introduction__
 
 In this tutorial we'll explore using Struts 2 to do more involved processing of a form submission. We'll cover how to use a Java model class to store the form input and how to create the Struts 2 form to match up with that model class.
 
-The code provided in this tutorial may be added to the _Coding Struts 2 Actions_  example or you can download this complete example from Google Code - [http://code.google.com/p/struts2-examples/downloads/list](http://code.google.com/p/struts2-examples/downloads/list).
+The code provided in this tutorial may be added to the [Coding Struts 2 Actions](coding-actions.html) example or you can download this complete example from Google Code - [http://code.google.com/p/struts2-examples/downloads/list](http://code.google.com/p/struts2-examples/downloads/list).
 
-
-
-| The [Struts 2 user mailing list](http://struts.apache.org/mail.html)^[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.
 
 __Forms and A Java Model Class__
 
 For this tutorial let's say we need to provide a form that a user may submit to register for a prize drawing. Our business rules state the user must provide his/her first name, last name, email address, and age.
 
-To encapsulate this data, we'll use a simple Java class that follows the basic Java Bean specifications (public set/get methods for each instance field). If you're following along add this class to package org.apache.struts.register.model in the _Coding Struts 2 Actions_  example.
+To encapsulate this data, we'll use a simple Java class that follows the basic Java Bean specifications (public set/get methods for each instance field). If you're following along add this class to package org.apache.struts.register.model in the [Coding Struts 2 Actions](coding-actions.html) example.
 
 **Person.java**
 
-
-~~~~~~~
-public class Person
-{
+```java
+public class Person {
     private String firstName;
     private String lastName;
     private String email;
     private int age;
 
-    public String getFirstName()
-    {
+    public String getFirstName() {
         return firstName;
     }
 
-    public void setFirstName(String firstName)
-    {
+    public void setFirstName(String firstName) {
         this.firstName = firstName;
     }
 
-    public String getLastName()
-    {
+    public String getLastName() {
         return lastName;
     }
 
-    public void setLastName(String lastName)
-    {
+    public void setLastName(String lastName) {
         this.lastName = lastName;
     }
 
-    public String getEmail()
-    {
+    public String getEmail() {
         return email;
     }
 
-    public void setEmail(String email)
-    {
+    public void setEmail(String email) {
         this.email = email;
     }
 
-    public int getAge()
-    {
+    public int getAge() {
         return age;
     }
 
-    public void setAge( int age)
-    {
+    public void setAge(int age) {
         this.age = age;
     }
 
-
-    public String toString()
-    {
+    public String toString() {
         return "First Name: " + getFirstName() + " Last Name:  " + getLastName() + 
         " Email:      " + getEmail() + " Age:      " + getAge() ;
     }
 }
-
-~~~~~~~
+```
 
 Note a few points about the above class. There is a public set/get method for each instance field. The age attribute is of type integer. We've defined a public toString method that returns a String representing the state of the object. Since we haven't specified a constructor, Java will provide a default constructor that will set all instance fields to their null values.
 
@@ -95,36 +78,33 @@ To collect the above information we'll use a Struts 2 form. When creating this f
 
 **register.jsp**
 
-
-~~~~~~~
+```xml
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"%>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-<title>Register</title>
-</head>
-<body>
-<h3>Register for a prize by completing this form.</h3>
-
-<s:form action="register">
-
- 	  <s:textfield name="personBean.firstName" label="First name" />
- 	  <s:textfield  name="personBean.lastName" label="Last name" />
- 	  <s:textfield name="personBean.email"  label ="Email"/>  
- 	  <s:textfield name="personBean.age"  label="Age"  />
- 	  
-   	  <s:submit/>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+    <title>Register</title>
+  </head>
+  <body>
+    <h3>Register for a prize by completing this form.</h3>
+
+    <s:form action="register">
+
+      <s:textfield name="personBean.firstName" label="First name" />
+      <s:textfield  name="personBean.lastName" label="Last name" />
+      <s:textfield name="personBean.email"  label ="Email"/>  
+      <s:textfield name="personBean.age"  label="Age"  />
+ 
+      <s:submit/>
    	  
-</s:form>	
+    </s:form>	
  
-</body>
+  </body>
 </html>
-
-~~~~~~~
+```
 
 Since we are using Struts 2 tags, at the top of the page we need the Struts tag library declaration.
 
@@ -134,18 +114,17 @@ Note the four Struts 2 textfield tags. Each tag has a name value that includes a
 
 The complete name value, personBean.firstName, instructs Struts 2 to use the input value for that textfield as the argument to the personBean object's setFirstName method. So if the user types "Bruce" in the textfield that has the label "First name", the personBean's firstName instance field will have a value of "Bruce".
 
-Note we have a Struts 2 textfield for each instance field of the class Person. Remember that Person class's age attribute is of type integer. All form field input values are Strings. Struts 2 will automatically convert the String value ("25") the user entered for the age form field to 25 when calling the setAge method of object personBean.
+Note that we have a Struts 2 textfield for each instance field of the class Person. Remember that Person class's age attribute is of type integer. All form field input values are Strings. Struts 2 will automatically convert the String value ("25") the user entered for the age form field to 25 when calling the setAge method of object personBean.
 
 __Creating the Action Class To Handle the Form Submission__
 
-When the user clicks on the submit button of the above form, the action "register" and the form data will be sent to the Struts 2 framework. We need an Action class to process this form. If you recall from the tutorial _Coding Struts 2 Actions_  our Action class should extends the Struts 2 ActionSupport class.
+When the user clicks on the submit button of the above form, the action "register" and the form data will be sent to the Struts 2 framework. We need an Action class to process this form. If you recall from the tutorial [Coding Struts 2 Actions](coding-actions.html) our Action class should extend the Struts 2 ActionSupport class.
 
 Here is the Action class used for this example. Place it in package org.apache.struts.register.action.
 
 **Register.java Struts 2 Action Class**
 
-
-~~~~~~~
+```java
 package org.apache.struts.register.action;
 
 import org.apache.struts.register.model.Person;
@@ -154,35 +133,28 @@ import com.opensymphony.xwork2.ActionSupport;
 
 public class Register extends ActionSupport {
 	
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 	
-	private Person personBean;
+    private Person personBean;
 	
 
-	@Override
-	public String execute() throws Exception {
-		
-		//call Service class to store personBean's state in database
-		
-		return SUCCESS;
-		
-	}
-	
-	public Person getPersonBean() {
-		
-		return personBean;
-		
-	}
-	
-	public void setPersonBean(Person person) {
-		
-		personBean = person;
-		
-	}
+    @Override
+    public String execute() throws Exception {
+        //call Service class to store personBean's state in database
 
-}
+        return SUCCESS;
+    }
 
-~~~~~~~
+    public Person getPersonBean() {
+        return personBean;
+    }
+
+    public void setPersonBean(Person person) {
+        personBean = person;
+    }
+
+}
+```
 
 In the Register class note that we've declared an attribute named personBean of type Person and there is a public get and set method for this object.
 
@@ -200,33 +172,27 @@ When SUCCESS is returned by the execute method we want to display a simple thank
 
 **thankyou.jsp**
 
-
-~~~~~~~
+```xml
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"%>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-<title>Registration Successful</title>
-</head>
-<body>
-<h3>Thank you for registering for a prize.</h3>
-
-<p>Your registration information: <s:property value="personBean" /> </p>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+    <title>Registration Successful</title>
+  </head>
+  <body>
+    <h3>Thank you for registering for a prize.</h3>
 
-<p><a href="<s:url action='index' />" >Return to home page</a>.</p>
+    <p>Your registration information: <s:property value="personBean" /> </p>
 
-</body>
+    <p><a href="<s:url action='index' />" >Return to home page</a>.</p>
+  </body>
 </html>
+```
 
-
-
-~~~~~~~
-
-If you don't recall how the Struts 2 property and url tags work consult the [Using Struts 2 Tags](#PAGE_14811875) tutorial.
+If you don't recall how the Struts 2 property and url tags work consult the [Using Struts 2 Tags](using-tags.html) tutorial.
 
 __Create action Node In struts.xml__
 
@@ -234,14 +200,11 @@ To specify the relationship between the form submission page, the Struts 2 Actio
 
 **action node for struts.xml**
 
-
-~~~~~~~
+```xml
 <action name="register" class="org.apache.struts.register.action.Register" method="execute">
   <result name="success">/thankyou.jsp</result>
 </action>
-
-
-~~~~~~~
+```
 
 The above action tells Struts 2 that when the register action is provided to call method execute of class Register. If that method returns result "success" return to the browser the thankyou.jsp.
 
@@ -253,11 +216,9 @@ So that the user can find the registration page, add this link to index.jsp
 
 **Link to register.jsp**
 
-
-~~~~~~~
+```html
 <p><a href="register.jsp">Please register</a> for our prize drawing.</p>
-
-~~~~~~~
+```
 
 __Run The Example__
 


[09/13] struts-site git commit: cleaned up form-vlaidation-using-xml page

Posted by lu...@apache.org.
cleaned up form-vlaidation-using-xml page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/4d57b53e
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/4d57b53e
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/4d57b53e

Branch: refs/heads/master
Commit: 4d57b53ee49157836dc3034edb2b173a1c77b164
Parents: 338b55f
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sun Apr 2 09:23:06 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sun Apr 2 09:23:06 2017 +0200

----------------------------------------------------------------------
 .../form-validation-using-xml.md                | 119 ++++++++-----------
 1 file changed, 48 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/4d57b53e/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 7e9a8a1..88e576f 100644
--- a/source/getting-started/form-validation-using-xml.md
+++ b/source/getting-started/form-validation-using-xml.md
@@ -6,19 +6,13 @@ title: Form validation using XML
 
 The example code for this tutorial, form_xml_validation, is available for checkout at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples)
 
-> 
+__Introduction__
 
-#####Introduction#####
+In this tutorial we'll cover how to validate a user's input in form fields using Struts 2's XML validation methodology. In the [Form Validation](form-validation.html) tutorial we discussed validating a user's input using the validate method in the Action class. Using a separate XML validation file gives you the ability to use validators built-in to the Struts 2 framework.
 
-In this tutorial we'll cover how to validate a user's input in form fields using Struts 2's XML validation methodology. In the _Form Validation_  tutorial we discussed validating a user's input using the validate method in the Action class. Using a separate XML validation file gives you the ability to use validators built-in to the Struts 2 framework.
+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)^[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#####
+__Example Application__
 
 The example application that supports this tutorial shows how to use Struts 2's XML validation methodology. The information that can be edited is encapsulated in an object of class Person.
 
@@ -28,110 +22,93 @@ To enable the user to edit his information that is stored in the Person object,
 
 When the user submits the form, we want to validate his entries into the form fields.
 
-#####Validation Using XML#####
+__Validation Using XML__
 
 To validate a user's form field entries you can use a separate XML file that contains your validation rules. The XML file that contains the validation rules must be named as ActionClassName-validation.xml. In the example application, the XML validation file is named EditAction-validation.xml (see src/main/resources/org/apache/struts/edit/action).
 
-Struts 2 provides several different validators that you can use in the XML validation file. See _Validation_  for a list of validators you can employ.
+Struts 2 provides several different validators that you can use in the XML validation file. See [Validation](//struts.apache.org/docs/validation.html) for a list of validators you can employ.
 
-In the above form, we want to ensure the user enters a first name. To have the Struts 2 framework enforce that rule we can used the Struts 2 _requiredstring validator_ . This validator checks that the user has entered a string value in the form field.
+In the above form, we want to ensure the user enters a first name. To have the Struts 2 framework enforce that rule we can used the Struts 2 [requiredstring validator](//struts.apache.org/docs/requiredstring-validator.html). This validator checks that the user has entered a string value in the form field.
 
-#####XML Validator Format#####
+__XML Validator Format__
 
 In the XML validation file (for this example that is EditAction-validation.xml), is this XML:
 
 **XML Validator Required String**
 
-
-~~~~~~~
-<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+```xml
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
 
 <validators>
- <validator type="requiredstring">
- 	<param name="fieldname">personBean.firstName</param>
- 	<message>First name is required.</message>
- </validator>
+    <validator type="requiredstring">
+        <param name="fieldname">personBean.firstName</param>
+        <message>First name is required.</message>
+    </validator>
 </validators>
+```
 
+Within the validators node you can have 1 or more validator nodes. The type attribute specifies which validator you want the Struts 2 framework to use (see [Validation](//struts.apache.org/docs/validation.html) ). The param name="fieldname" node is used to tell the framework which form field entry to apply the rule to. See edit.jsp for the form fields and their name value (review [Struts 2 Form Tags](form-tags.html) if you're not familiar with how to use Struts 2 form tags). The message node is used to tell the framework what message to display if the validation fails.
 
-~~~~~~~
-
-Within the validators node you can have 1 or more validator nodes. The type attribute specifies which validator you want the Struts 2 framework to use (see _Validation_ ). The param name="fieldname" node is used to tell the framework which form field entry to apply the rule to. See edit.jsp for the form fields and their name value (review [Struts 2 Form Tags](#PAGE_19300595) if you're not familiar with how to use Struts 2 form tags). The message node is used to tell the framework what message to display if the validation fails.
-
-
-
-| There are alternate ways to write the XML that goes in the validation XML file. See _Validation_  in the Struts 2 documentation for a full discussion.
-
-| 
+| There are alternate ways to write the XML that goes in the validation XML file. See [Validation](//struts.apache.org/docs/validation.html) in the Struts 2 documentation for a full discussion.
 
 For example if the user doesn't enter a value in the first name form field and clicks on the Save Changes button, he will see the following.
 
 ![form-validation-2.png](attachments/att20873264_form-validation-2.png)
 
-#####Validating An Email Address#####
+__Validating An Email Address__
 
-You can use the Struts 2 _email validator_  to validate the user's input in the email field. Here is the validator node that is in the EditAction-validation.xml file.
+You can use the Struts 2 [email validator](//struts.apache.org/docs/email-validator.html) to validate the user's input in the email field. Here is the validator node that is in the `EditAction-validation.xml` file.
 
 **Email Validator**
 
-
-~~~~~~~
- <validator type="requiredstring">
- 	<param name="fieldname">personBean.email</param>
- 	<message>Email address is required.</message>
- </validator>
- <validator type="email">
- 	<param name="fieldname">personBean.email</param>
- 	<message>Email address not valid.</message>
- </validator>
-
-
-~~~~~~~
+```xml
+<validator type="requiredstring">
+    <param name="fieldname">personBean.email</param>
+    <message>Email address is required.</message>
+</validator>
+<validator type="email">
+    <param name="fieldname">personBean.email</param>
+    <message>Email address not valid.</message>
+</validator>
+```
 
 Note that in the example, we are requiring the user to enter an email address and then validating the email address the user entered.
 
-#####Validating A User's Input Using A Regular Expression#####
+__Validating A User's Input Using A Regular Expression__
 
-The Struts 2 framework provides a powerful way to validate a user's form field input by using the _regex validator_ . In the example application, we want to ensure the user enters the phone number in the format 999-999-9999. We can use a regular expression and the _regex validator_  to enforce this rule.
+The Struts 2 framework provides a powerful way to validate a user's form field input by using the [regex validator](//struts.apache.org/docs/regex-validator.html) . In the example application, we want to ensure the user enters the phone number in the format 999-999-9999. We can use a regular expression and the [regex validator](//struts.apache.org/docs/regex-validator.html) to enforce this rule.
 
 **REGEX Validator**
 
-
-~~~~~~~
+```xml
 <validator type="requiredstring">
- 	<param name="fieldname">personBean.phoneNumber</param>
- 	<message>Phone number is required.</message>
- </validator>
+    <param name="fieldname">personBean.phoneNumber</param>
+    <message>Phone number is required.</message>
+</validator>
 <validator type="regex">
-	<param name="fieldname">personBean.phoneNumber</param>
-	<param name="regex"><![CDATA[\d{3}-\d{3}-\d{4}]]></param>
-	<message>Phone number must be entered as 999-999-9999.</message>
+    <param name="fieldname">personBean.phoneNumber</param>
+    <param name="regex"><![CDATA[\d{3}-\d{3}-\d{4}]]></param>
+    <message>Phone number must be entered as 999-999-9999.</message>
 </validator>
-
-
-~~~~~~~
+```
 
 The param name="expression" node is used to specify the regular expression that will be applied to the user's input. Note how the regular expression is contained within a CDATA section.
 
-#####Validating A User's Input Using An OGNL Expression#####
+__Validating A User's Input Using An OGNL Expression__
 
-In the example application, we want to ensure the user checks at least one of the car model check boxes. To enforce this rule we can use the _fieldexpression validator_ . Here's the XML for that validator node.
+In the example application, we want to ensure the user checks at least one of the car model check boxes. To enforce this rule we can use the [fieldexpression validator](//struts.apache.org/docs/fieldexpression-validator.html) . Here's the XML for that validator node.
 
 **FieldExpression Validator**
 
-
-~~~~~~~
+```xml
 <validator type="fieldexpression">
-	<param name="fieldname">personBean.carModels</param>
-	<param name="expression"><![CDATA[personBean.carModels.length > 0]]></param>
-	<message>You must select at least one car model.</message>
+    <param name="fieldname">personBean.carModels</param>
+    <param name="expression"><![CDATA[personBean.carModels.length > 0]]></param>
+    <message>You must select at least one car model.</message>
 </validator>
+```
 
-
-~~~~~~~
-
-The param name="expression" node contains an OGNL expression that evaluates to true or false. We haven't previously discussed OGNL, which stands for Object-Graph Navigation Language (see [http://www.opensymphony.com/ognl/](http://www.opensymphony.com/ognl/) and _OGNL_ ). OGNL expressions can be evaluated by the Struts 2 framework as Java statements.
+The param name="expression" node contains an OGNL expression that evaluates to true or false. We haven't previously discussed OGNL, which stands for Object-Graph Navigation Language (see [http://www.opensymphony.com/ognl/](http://www.opensymphony.com/ognl/) and [OGNL](//struts.apache.org/docs/ognl.html) ). OGNL expressions can be evaluated by the Struts 2 framework as Java statements.
 
 In the above XML the value of the param name="expression" node, personBean.carModels.length \> 0, will be evaluated by the framework as a Java statement. The part personBean.carModels tells the framework to call the getCarModels method of class Person. That method returns an Array. Since class Array has a length attribute, the framework will get the value of the length attribute of the Array returned by the getCarModels method.
 
@@ -141,6 +118,6 @@ If the user did not check any of the check boxes, the Array returned by the getC
 
 The fieldexpression validator is useful when doing conditional validation of a user's input. If the OGNL expression doesn't evaluate to true then the user's input won't be allowed.
 
-#####Summary#####
+__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.


[12/13] struts-site git commit: cleaned up themes page

Posted by lu...@apache.org.
cleaned up themes page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/263cb507
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/263cb507
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/263cb507

Branch: refs/heads/master
Commit: 263cb507d0c2aa811b41a172401908047b120611
Parents: 67828ff
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sun Apr 2 10:29:13 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sun Apr 2 10:29:13 2017 +0200

----------------------------------------------------------------------
 source/getting-started/themes.md | 89 ++++++++++++-----------------------
 1 file changed, 29 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/263cb507/source/getting-started/themes.md
----------------------------------------------------------------------
diff --git a/source/getting-started/themes.md b/source/getting-started/themes.md
index e15c42a..15a785a 100644
--- a/source/getting-started/themes.md
+++ b/source/getting-started/themes.md
@@ -6,34 +6,25 @@ title: Themes
 
 The example code for this tutorial, themes, is available for checkout at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples)
 
-> 
-
-#####Introduction#####
+__Introduction__
 
 When you use a Struts 2 tag such as s:select in your web page, the Struts 2 framework generates HTML that styles the appearance and controls the layout of the select control. The style and layout is determined by which Struts 2 theme is set for the tag. Struts 2 comes with three built-in themes: simple, xhtml, and css_xhtml. If you don\u2019t specify a theme, then Struts 2 will use the xhtml theme by default.
 
-
-
-| The [Struts 2 user mailing list](http://struts.apache.org/mail.html)^[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.
 
 For example, this Struts 2 select tag:
 
 **Struts 2 Select Tag**
 
-
-~~~~~~~
+```html
 <s:select key="personBean.sport" list="sports" />
-
-~~~~~~~
+```
 
 generates this HTML markup:
 
 **HTML Created By Struts 2 Select Tag**
 
-
-~~~~~~~
+```html
 <tr>
 <td class="tdLabel">
 <label for="save_personBean_sport" class="label">Favorite sport:</label>
@@ -46,14 +37,13 @@ generates this HTML markup:
 </select>
 </td>
 </tr>
-
-~~~~~~~
+```
 
 Notice how the HTML generated uses table tags to control the layout of the label and select HTML. There is also a class, tdLabel, applied to the table column where the label tag is rendered. Since no theme was specified for the Struts 2 select tag the default xhmtl theme was used.
 
-#####Specifying The Theme Struts 2 Should Use#####
+__Specifying The Theme Struts 2 Should Use__
 
-The Struts 2 tags have a theme attribute you can use to specify which Struts 2 theme should be used when creating the HTML for that tag. The values for the theme attribute are simple, xhtml, css_xhtml, and ajax. To learn more about these themes visit _Themes and Templates Documentation_ . This tutorial will review the xhtml, css_xhtml, and the simple themes. The ajax theme is a special theme used for ajax operations (see _Ajax Theme in the documentation_ ).
+The Struts 2 tags have a theme attribute you can use to specify which Struts 2 theme should be used when creating the HTML for that tag. The values for the theme attribute are simple, xhtml, css_xhtml, and ajax. To learn more about these themes visit [Themes and Templates Documentation](//struts.apache.org/docs/themes-and-templates.html) . This tutorial will review the xhtml, css_xhtml, and the simple themes. The ajax theme is a special theme used for ajax operations (see [Ajax Theme in the documentation](http://struts.apache.org/docs/ajax-theme.html) ).
 
 You can specify the theme on a per Struts 2 tag basis or you can use one of the following methods to specify what theme Struts 2 should use:
 
@@ -69,9 +59,9 @@ You can specify the theme on a per Struts 2 tag basis or you can use one of the
 
 6. The application-scoped attribute named "theme"
 
-7. The struts.ui.theme property in struts.properties (defaults to xhtml)
+7. The `struts.ui.theme` property in `struts.properties` (defaults to xhtml)
 
-Consult _Selecting Themes_  for how to set the theme using the above approaches.
+Consult [Selecting Themes](//struts.apache.org/docs/selecting-themes.html) for how to set the theme using the above approaches.
 
 In the example application, examine edit.jsp. The theme attribute of the form tag is set to xhtml. Run the application (see the readme.txt file) and view the source for edit.jsp after it is rendered in your browser. You should see the form HTML tags layout controlled by table tags.
 
@@ -79,16 +69,15 @@ Change the theme to simple for the form\u2019s theme attribute and redeploy the app
 
 Change the theme to css_xhtml for the form\u2019s theme attribute and redeploy the application. Examine the source for edit.jsp after it is rendered in the browser. The layout of the form tags is now controlled by div tags and the label tags are back.
 
-#####Specifying The CSS Used By The Struts 2 Tag#####
+__Specifying The CSS Used By The Struts 2 Tag__
 
-Change the theme attribute for the form tag back to xhtml. Notice when you view the source of edit.jsp after it is rendered in the browser that there is a class named tdLabel applied to the table column that contains the label. This CSS class controls the position of the label in the table column. The tdLabel style is defined in /themes/struts/xhtml/styles.css. The link to this style sheet was included in edit.jsp\u2019s head section when you add the s:head tag to edit.jsp.
+Change the theme attribute for the form tag back to xhtml. Notice when you view the source of edit.jsp after it is rendered in the browser that there is a class named tdLabel applied to the table column that contains the label. This CSS class controls the position of the label in the table column. The tdLabel style is defined in /themes/struts/xhtml/styles.css. The link to this style sheet was included in edit.jsp\u2019s head section when you add the `s:head` tag to `edit.jsp`.
 
 Load this style sheet in your browser (in the example application the link is [http://localhost:8080/themes/struts/xhtml/styles.css](http://localhost:8080/themes/struts/xhtml/styles.css) if your Servlet container is running on localhost, port 8080). You\u2019ll see the following:
 
 **styles.css**
 
-
-~~~~~~~
+```css
 .label {font-style:italic; }
 .errorLabel {font-style:italic; color:red; }
 .errorMessage {font-weight:bold; color:red; }
@@ -96,26 +85,23 @@ Load this style sheet in your browser (in the example application the link is [h
 .checkboxErrorLabel {color:red; }
 .required {color:red;}
 .tdLabel {text-align:right; vertical-align:top; }
-
-~~~~~~~
+```
 
 So the .label selector renders the label tag\u2019s text in italic. The .tdLabel tag specifies that the text should align to the right and top of the table column.
 
-You can override the above selectors by including the same selectors in your page\u2019s head section. For example add the following to the head section of edit.jsp.
+You can override the above selectors by including the same selectors in your page\u2019s head section. For example add the following to the head section of `edit.jsp`.
 
 **Override Label Style**
 
-
-~~~~~~~
+```html
 <style type="text/css">
-  .label {color:blue; font-style:normal; font-weight:bold}
+    .label {color:blue; font-style:normal; font-weight:bold}
 </style>
-
-~~~~~~~
+```
 
 Now the label tag will render the text in blue, bold, normal (not italics) style.
 
-#####Creating And Applying Your Own Themes For Struts 2 Tags#####
+__Creating And Applying Your Own Themes For Struts 2 Tags__
 
 The theme templates (simple, xhtml, css_xhtml) can be found in the Struts 2 core jar file. If you expand (extract the files) the Struts 2 core jar file you'll find folders named template.css_xhtml, template.simple, and template.xhtml. Those folders contain the templates for the three default Struts 2 themes. In each folder is a file for each Struts 2 tag. For example if you expand the template.xhtml folder you\u2019ll see the select.ftl file.
 
@@ -125,53 +111,36 @@ Also in the template.xhmtl folder is the styles.css file. This is the styles.css
 
 Let\u2019s say we wanted to create our own theme that will change how the Struts 2 checkboxlist tag displays the checkboxes and their labels.
 
-In the example application I've extended the default XHMTL theme (see file theme.properties under src/main/resources/template/KUTheme). �The checkboxlist.ftl theme that is part of the XHTML theme only includes a space between each label and the next checkbox (see checkboxlist.ftl in the template/simple folder in Struts 2 core). That is why all the checkboxes are displayed across the width of the browser window. For my custom checkboxlist theme I want to have a break tag after each label tag so that each checkbox and its label will be on their own line.
+In the example application I've extended the default XHMTL theme (see file `theme.properties` under src/main/resources/template/KUTheme). �The checkboxlist.ftl theme that is part of the XHTML theme only includes a space between each label and the next checkbox (see checkboxlist.ftl in the template/simple folder in Struts 2 core). That is why all the checkboxes are displayed across the width of the browser window. For my custom checkboxlist theme I want to have a break tag after each label tag so that each checkbox and its label will be on their own line.
 
 In the example application there is a folder named src/main/resources/template/KUTheme. In that folder is a checkboxlist.ftl, the contents of which I originally copied from the checkboxlist.ftl that is in the templates.xhtml folder from the struts 2 core jar.
 
-I then modified the checkboxlist.ftl in the KUTheme folder to be:
+I then modified the `checkboxlist.ftl` in the KUTheme folder to be:
 
 **Modified checkboxlist.ftl**
 
-
-~~~~~~~
+```ftl
 <#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" />
 
 <#include "/${parameters.templateDir}/KUTheme_simple/checkboxlist.ftl" />
 
 <#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" /><#nt/>
-
-~~~~~~~
+```
 
 Be sure to note the change to the second line\u2014using KUTheme_simple in the path.
 
-Then in the example application I created a KUTheme_simple folder under 
-
-~~~~~~~
-src/main/resources/template
-~~~~~~~
- (optionally you can place it under 
-
-~~~~~~~
-webapp
-~~~~~~~
-, e.g. 
-
-~~~~~~~
-src/main/webapp/template
-~~~~~~~
-). In that folder I created checkboxlist.ftl and copied the contents from template.simple checkboxlist.ftl (again found in the Struts 2 core jar). After copying the contents to checkboxlist.ftl that is in KUTheme_simple folder, I modified checkboxlist.ftl so that the label tag has a style of red bold text and I added a break tag after each label so that each check box and label will be on its own line.
+Then in the example application I created a KUTheme_simple folder under `src/main/resources/template` (optionally you can place it under `webapp`, e.g. `src/main/webapp/template` ). In that folder I created checkboxlist.ftl and copied the contents from `template.simple` `checkboxlist.ftl` (again found in the Struts 2 core jar). After copying the contents to checkboxlist.ftl that is in KUTheme_simple folder, I modified checkboxlist.ftl so that the label tag has a style of red bold text and I added a break tag after each label so that each check box and label will be on its own line.
 
-Since the XHTML theme is the default theme and I have a theme.properties file defined with parent = xhtml, the KUTheme will inherit all the themes from xhmtl exempt for the theme for the checkboxlist tag since my KUTheme includes a definition for that tag's layout. �In the struts.xml file (src/main/resources) you will see that the I've specified the default theme to be KUTheme.
+Since the XHTML theme is the default theme and I have a theme.properties file defined with parent = xhtml, the KUTheme will inherit all the themes from xhmtl exempt for the theme for the checkboxlist tag since my KUTheme includes a definition for that tag's layout. �In the `struts.xml` file (src/main/resources) you will see that the I've specified the default theme to be KUTheme.
 
-In the deployed web application, Struts 2 will first look for a tag's template on the application's class path�and if it doesn't find the template there it will use the default template that is part of the Struts 2 core jar. Since we've added a template folder to the application's web root, now when Struts 2 creates the HTML to display the checkboxlist tag it will use the template that is in the KUTheme folder (which tells it to use the checkboxlist.ftl file that is in the KUTheme_simple folder instead of the one in the template.simple folder that is part of the Struts 2 core Jar).
+In the deployed web application, Struts 2 will first look for a tag's template on the application's class path�and if it doesn't find the template there it will use the default template that is part of the Struts 2 core jar. Since we've added a template folder to the application's web root, now when Struts 2 creates the HTML to display the checkboxlist tag it will use the template that is in the KUTheme folder (which tells it to use the `checkboxlist.ftl` file that is in the KUTheme_simple folder instead of the one in the `template.simple` folder that is part of the Struts 2 core Jar).
 
 After redeploying the application the check boxes for the Car Models Owned should appear like:
 
 ![Screen shot 2010-09-11 at 12.37.12 PM.png](attachments/att23527657_Screen shot 2010-09-11 at 12.37.12 PM.png)
 
-#####Summary#####
+__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.
+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_ .
+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) .


[11/13] struts-site git commit: cleaned up wildcard-method-selection page

Posted by lu...@apache.org.
cleaned up wildcard-method-selection page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/67828ffd
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/67828ffd
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/67828ffd

Branch: refs/heads/master
Commit: 67828ffdefac27f3fd7609c9940c27cf2551981c
Parents: 9ee4d15
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sun Apr 2 10:03:59 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sun Apr 2 10:03:59 2017 +0200

----------------------------------------------------------------------
 .../wildcard-method-selection.md                | 58 ++++++++------------
 1 file changed, 23 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/67828ffd/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 f0992de..277d950 100644
--- a/source/getting-started/wildcard-method-selection.md
+++ b/source/getting-started/wildcard-method-selection.md
@@ -6,62 +6,50 @@ title: Wildcard Method Selection
 
 The example code for this tutorial, wildcard_method_selection, is available for checkout at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples)
 
-> 
-
-#####Introduction#####
+__Introduction__
 
 In this tutorial we'll cover how to configure an action node in the struts.xml configuration file so that one action node can be used to relate several different Action URLs to specific methods of the Action class. This will reduce the number of action nodes we must write in the struts.xml configuration file.
 
+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)^[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#####
+__Example Application__
 
 ![Screen shot 2010-05-30 at 8.51.40 AM.png](attachments/att21921805_Screen shot 2010-05-30 at 8.51.40 AM.png)
 
-The example application that supports this tutorial shows how to use Struts 2's wildcard method selection methodology. The example application is just a simple one that lists some people and lets you edit them, delete them, and add a new person to the list. Everything that the application needs to do with a Person (the model class) is controlled by the Struts 2 ActionSupport class PersonAction. The PersonAction class has several different methods (e.g. create, edit, delete) that are called depending on what the user wants to do.
+The example application that supports this tutorial shows how to use Struts 2's wildcard method selection methodology. The example application is just a simple one that lists some people and lets you edit them, delete them, and add a new person to the list. Everything that the application needs to do with a `Person` (the model class) is controlled by the Struts 2 `ActionSupport` class `PersonAction`. The `PersonAction` class has several different methods (e.g. create, edit, delete) that are called depending on what the user wants to do.
 
-#####Wildcard Method Selection#####
+__Wildcard Method Selection__
 
 Without using the wildcard method selection technique, I'd have to write an action mapping node in the Struts 2 configuration file for each separate action I'd want to call. For example:
 
 **Struts.xml Action Configuration**
 
-
-~~~~~~~
+```xml
 <action name="createPerson" class="org.apache.struts.tutorials.wildcardmethod.action.PersonAction" method="create">
-  <result name="input">input.jsp</result>
-  <result name="success">view.jsp</result>
+    <result name="input">input.jsp</result>
+    <result name="success">view.jsp</result>
 </action>
 
 <action name="editPerson" class="org.apache.struts.tutorials.wildcardmethod.action.PersonAction" method="edit">
-  <result name="input">input.jsp</result>
-  <result name="success">view.jsp</result>
+    <result name="input">input.jsp</result>
+    <result name="success">view.jsp</result>
 </action>
-
-
-~~~~~~~
+```
 
 So even for this simple application, I'd have to write four separate action mapping nodes (create, edit, delete, saveOrUpdate) in the configuration file. So you can easily see that a more complex application can have dozens of action mapping nodes.
 
-To implement the wildcard method selection technique to enable the Struts 2 framework to dynamically select the correct method to call at runtime you just need to use the wildcard character, \*, in your name value and an attribute value place holder ( \{1\} ) for the method value. For example:
+To implement the wildcard method selection technique to enable the Struts 2 framework to dynamically select the correct method to call at runtime you just need to use the wildcard character, *, in your name value and an attribute value place holder ( `{1}` ) for the method value. For example:
 
 **Struts.xml Action Configuration Using Wildcard Method Selection**
 
-
-~~~~~~~
+```xml
 <action name="*Person" class="org.apache.struts.tutorials.wildcardmethod.action.PersonAction" method="{1}">
-  <result name="success">view.jsp</result>
-  <result name="input">input.jsp</result>
+    <result name="success">view.jsp</result>
+    <result name="input">input.jsp</result>
 </action>
+```
 
-
-~~~~~~~
-
-The \* is the wildcard character. Any action name values that end in "Person" will be handled by this action mapping. Whatever value is before "Person" will be the value used for the method attribute (the \{1\} place holder will be replaced with that value). For example this URL:
+The `*` is the wildcard character. Any action name values that end in "Person" will be handled by this action mapping. Whatever value is before "Person" will be the value used for the method attribute (the `{1}` place holder will be replaced with that value). For example this URL:
 
 [http://localhost:8080/wildcard-method-selection/createPerson.action](http://localhost:8080/wildcard-method-selection/createPerson.action)
 
@@ -69,20 +57,20 @@ will be be processed by the the above action mapping and method create of class
 
 [http://localhost:8080/wildcard-method-selection/deletePerson.action](http://localhost:8080/wildcard-method-selection/deletePerson.action)
 
-will cause the delete method of class PersonAction to be called.
+will cause the delete method of class `PersonAction` to be called.
 
 What happens if we have a URL with nothing in front of Person? For example:
 
 [http://localhost:8080/wildcard-method-selection/Person.action](http://localhost:8080/wildcard-method-selection/Person.action)
 
-If there is no value in front of Person, then the Struts 2 framework will call the execute method of the class PersonAction.
+If there is no value in front of Person, then the Struts 2 framework will call the execute method of the class `PersonAction`.
 
-#####Dynamic Method Invocation#####
+__Dynamic Method Invocation__
 
-The wildcard method selection technique explained above should not be confused with the "Dynamic Method Invocation" technique. The Struts 2 documentation explains this technique (which uses the bang, \!, operator in the action name) and recommends against using the "Dynamic Method Invocation" technique due to security and other reasons related to how this technique is implemented internally.
+The wildcard method selection technique explained above should not be confused with the "Dynamic Method Invocation" technique. The Struts 2 documentation explains this technique (which uses the bang, `!`, operator in the action name) and recommends against using the "Dynamic Method Invocation" technique due to security and other reasons related to how this technique is implemented internally.
 
-The Struts 2 documentation also recommends turning off the option to use the dynamic method invocation by setting struts.enable.DynamicMethodInvocation to FALSE in the Struts configuration.
+The Struts 2 documentation also recommends turning off the option to use the dynamic method invocation by setting `struts.enable.DynamicMethodInvocation` to `FALSE` in the Struts configuration.
 
-#####Summary#####
+__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.


[04/13] struts-site git commit: cleaned up the form-validation page

Posted by lu...@apache.org.
cleaned up the form-validation page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/d7ba877e
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/d7ba877e
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/d7ba877e

Branch: refs/heads/master
Commit: d7ba877e4db101d60f2f0e4604d7fa958e204e0e
Parents: f2cb6c6
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sat Apr 1 20:24:29 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sat Apr 1 20:24:29 2017 +0200

----------------------------------------------------------------------
 source/getting-started/form-validation.md | 82 ++++++++------------------
 1 file changed, 26 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/d7ba877e/source/getting-started/form-validation.md
----------------------------------------------------------------------
diff --git a/source/getting-started/form-validation.md b/source/getting-started/form-validation.md
index 0d16c4c..bf4a3b4 100644
--- a/source/getting-started/form-validation.md
+++ b/source/getting-started/form-validation.md
@@ -4,7 +4,7 @@ title: Form Validation
 ---
 ## Form Validation
 
-This tutorial assumes you've completed the _Processing Forms_  tutorial and have a working form_processing project. The example code for this tutorial, form_validation, is available for checkout from the Struts 2 GitHub repository: [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
+This tutorial assumes you've completed the [Processing Forms](processing-forms.html) tutorial and have a working form_processing project. The example code for this tutorial, form_validation, is available for checkout from the Struts 2 GitHub repository: [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples).
 
 > 
 
@@ -12,21 +12,17 @@ __Introduction__
 
 In this tutorial we'll explore using Struts 2 to validate the user's input on a form. There are two ways you can use Struts 2 to do form validation. This tutorial will cover the more basic method, where the validation is included in the Struts 2 Action class.
 
-
-
-| The [Struts 2 user mailing list](http://struts.apache.org/mail.html)^[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.
 
 __Add validate Method__
 
 To enable the Struts 2 Action class to validate a user's input on a Struts 2 form, you must define a validate method in your Action class. Using the example from _Processing Forms_  tutorial, let's say that we have these business rules:
 
 1. User must provide a first name
- 2. User must provide an email address
- 3. User younger then 18 cannot register
+2. User must provide an email address
+3. User younger then 18 cannot register
 
-If you recall from the _Processing Forms_  tutorial the user's input into the form fields is placed by Struts 2 into the Java model class personBean. So a user's input into the firstName field would end up as the value for personBean's firstName instance field (via the personBean.setFirstName method).
+If you recall from the [Processing Forms](processing-forms.html) tutorial the user's input into the form fields is placed by Struts 2 into the Java model class personBean. So a user's input into the firstName field would end up as the value for personBean's firstName instance field (via the personBean.setFirstName method).
 
 In the validate method we can refer to get the values of personBean's instance fields by using the appropriate get methods. Once we have the values we can employ logic to enforce our business rules.
 
@@ -34,33 +30,21 @@ Add the following validate method to Register.java (the Action class).
 
 **validate method**
 
+```java
+    public void validate(){
+        if (personBean.getFirstName().length() == 0) {
+            addFieldError("personBean.firstName", "First name is required.");
+        }
 
-~~~~~~~
-	public void validate(){
-		
-		if ( personBean.getFirstName().length() == 0 ){	
-
-			addFieldError( "personBean.firstName", "First name is required." );
-			
-		}
-		
-				
-		if ( personBean.getEmail().length() == 0 ){	
-
-			addFieldError( "personBean.email", "Email is required." );
-			
-		}
-		
-		if ( personBean.getAge() < 18 ){	
-
-			addFieldError( "personBean.age", "Age is required and must be 18 or older" );
-			
-		}
-		
-		
-	}
+        if (personBean.getEmail().length() == 0) {
+            addFieldError("personBean.email", "Email is required.");
+        }
 
-~~~~~~~
+        if (personBean.getAge() < 18) {
+            addFieldError("personBean.age", "Age is required and must be 18 or older");
+        }
+    }
+```
 
 When the user presses the submit button on the register form, Struts 2 will transfer the user's input to the personBean's instance fields. Then Struts 2 will automatically execute the validate method. If any of the if statements are true, Struts 2 will call its addFieldError method (which our Action class inherited by extending ActionSupport).
 
@@ -72,11 +56,9 @@ So what should we do if Struts 2 returns "input" indicating that the user's inpu
 
 To handle the return value of "input" we need to add the following result to our action node in struts.xml.
 
-
-~~~~~~~
+```xml
 <result name="input">/register.jsp</result>
-
-~~~~~~~
+```
 
 The above result node goes just after the success result node for the register action and before the closing of the action node.
 
@@ -86,15 +68,13 @@ So when validation fails and Struts 2 returns input, the Struts 2 framework will
 
 So the following addFieldError method call:
 
-
-~~~~~~~
-addFieldError( "personBean.firstName", "First name is required.")
-
-~~~~~~~
+```java
+    addFieldError("personBean.firstName", "First name is required.")
+```
 
 will cause the message "First name is required" to be displayed above the firstName field on the form.
 
-If you have made the above changes to the _Processing Forms_  tutorial or you have downloaded from [Google Code](http://code.google.com/p/struts2-examples/downloads/list)^[http://code.google.com/p/struts2-examples/downloads/list] either the Form_Validation_Struts2_Ant or Form_Validation_Struts2_Mvn projects run the application (see the README.txt in the project root folder). Click on the Please register link. On the registration form, just click the submit button and you should see:
+If you have made the above changes to the _Processing Forms_  tutorial or you have downloaded from [Google Code](http://code.google.com/p/struts2-examples/downloads/list) either the Form_Validation_Struts2_Ant or Form_Validation_Struts2_Mvn projects run the application (see the README.txt in the project root folder). Click on the Please register link. On the registration form, just click the submit button and you should see:
 
 ![form_errors.png](attachments/att14975003_form_errors.png)
 
@@ -102,23 +82,13 @@ Struts 2 called the validate method, validation failed, the register.jsp was dis
 
 __Styling The Error Messages__
 
-The Struts 2 s:head tag can be used to provide CSS that includes a style for the error message. Add 
-
-~~~~~~~
-<s:head />
-~~~~~~~
- to register.jsp before the closing HTML 
-
-~~~~~~~
-</head>
-~~~~~~~
- tag. Go through the same steps as above and you should see:
+The Struts 2 s:head tag can be used to provide CSS that includes a style for the error message. Add `<s:head />` to register.jsp before the closing HTML `</head>` tag. Go through the same steps as above and you should see:
 
 ![form_errors_styled.png](attachments/att14975001_form_errors_styled.png)
 
 __Summary__
 
-This tutorial covered validating a user's form input by adding a validate method to an Action class. There is another more sophisticated way to validate user input using XML. If you want to learn more about using XML for validation in Struts 2 see _Validation_ .
+This tutorial covered validating a user's form input by adding a validate method to an Action class. There is another more sophisticated way to validate user input using XML. If you want to learn more about using XML for validation in Struts 2 see [Validation](//struts.apache.org/docs/validation.html) .
 
 __Up Next__
 


[13/13] struts-site git commit: cleaned up spring page

Posted by lu...@apache.org.
cleaned up spring page


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/30412c4d
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/30412c4d
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/30412c4d

Branch: refs/heads/master
Commit: 30412c4dd8590ba6cdcd8bdd64b9aa43bc426872
Parents: 263cb50
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sun Apr 2 11:06:16 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sun Apr 2 11:06:16 2017 +0200

----------------------------------------------------------------------
 source/getting-started/spring.md | 172 ++++++++--------------------------
 1 file changed, 41 insertions(+), 131 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/30412c4d/source/getting-started/spring.md
----------------------------------------------------------------------
diff --git a/source/getting-started/spring.md b/source/getting-started/spring.md
index 0153349..3f3acde 100644
--- a/source/getting-started/spring.md
+++ b/source/getting-started/spring.md
@@ -6,25 +6,13 @@ title: Spring
 
 The example code for this tutorial, spring_struts, is available for checkout at [https://github.com/apache/struts-examples](https://github.com/apache/struts-examples)
 
-> 
-
-#####Introduction#####
+__Introduction__
 
 In the execute method of many Struts 2 ActionSupport classes are statements that create objects and then have those objects execute methods that perform needed tasks. Whenever one class creates an object of another class that introduces a dependency between the two classes. The Spring framework makes it easier for the application developer to manage these dependencies and helps make the application more flexible and maintainable. This tutorial will show you how to use Struts 2 and Spring together to manage the dependencies between your ActionSupport classes and other classes in your application.
 
-
-> 
-
-> 
-
 > This tutorial assumes you understand how to use the Spring framework to manage dependencies between classes. You can learn more about Spring by reading the documentation at [http://www.springsource.org/documentation](http://www.springsource.org/documentation)
 
-> 
-
-
-| 
-
-| The [Struts 2 user mailing list](http://struts.apache.org/mail.html)^[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.
 
 | 
 
@@ -32,82 +20,64 @@ If you examine the example application for the [Struts 2 Themes](#PAGE_23337450)
 
 **EditAction Class Hard-Coded Dependency**
 
-
-~~~~~~~
+```java
 private EditService editService = new EditServiceInMemory();
+```
 
+The above statement hard-codes a dependency between the `EditAction` class and the `EditServiceInMemory` class. This is poor design for two reasons.
 
-~~~~~~~
+1. If I need to replace the `EditServiceInMemory` with another class that implements the `EditService` interface I'll have to hunt down and replace all statements where I hard-coded the dependency.
 
-The above statement hard-codes a dependency between the EditAction class and the EditServiceInMemory class. This is poor design for two reasons.
+2. I cannot test `EditAction` without using the `EditServiceInMemory` class. I cannot isolate `EditAction` by using a stub implementation of `EditService` when writing my test case because the use of `EditServiceInMemory` is hard-coded.
 
-1. If I need to replace the EditServiceInMemory with another class that implements the EditService interface I'll have to hunt down and replace all statements where I hard-coded the dependency.
-
-2. I cannot test EditAction without using the EditServiceInMemory class. I cannot isolate EditAction by using a stub implementation of EditService when writing my test case because the use of EditServiceInMemory is hard-coded.
-
-Spring provides a mechanism to manage dependencies by injecting them at run time. Struts 2 ActionSupport classes\u2014like any other Java class\u2014can be injected with a dependent object by the Spring framework. So instead of having the above code, I would have this statement in EditAction.
+Spring provides a mechanism to manage dependencies by injecting them at run time. Struts 2 ActionSupport classes\u2014like any other Java class\u2014can be injected with a dependent object by the Spring framework. So instead of having the above code, I would have this statement in `EditAction`.
 
 **EditAction Class No Hard-Coded Dependency**
 
-
-~~~~~~~
+```java
     private EditService editService ;
-
-
-~~~~~~~
+```
 
 At run time the Spring framework will provide an object of a class that implements the EditService interface.
 
-#####Struts 2 Spring Plugin#####
+__Struts 2 Spring Plugin__
 
-Struts 2 provides a plugin that enables Spring to inject into the ActionSupport classes any dependent objects you've specified in the Spring configuration file. Consult _Spring Plugin documentation_  for more information about how the plugin works.
+Struts 2 provides a plugin that enables Spring to inject into the ActionSupport classes any dependent objects you've specified in the Spring configuration file. Consult [Spring Plugin documentation](//struts.apache.org/docs/spring-plugin.html) for more information about how the plugin works.
 
 For a Maven application you'll need to add a dependency to the struts2-spring-plugin jar (see the Maven example application for this tutorial). The plugin's pom.xml includes transitive dependencies to the Spring jar files.
 
 
+| The current version (`2.5.10.1`) of the Struts 2 Spring plugin has transitive dependencies to the Spring `4.1.6.RELEASE` version. If you want to use the latest version of Spring, then you should exclude the transitive dependencies in your pom.xml for the Struts 2 Spring plugin and then declare dependency nodes to the current version of the Spring jar files. If you are using Ant and explicitly including the jar files in your application, then just include the latest version of the Spring jar files.
 
-| The current version (2.3.15) of the Struts 2 Spring plugin has transitive dependencies to the Spring 3.0.5 version. If you want to use the latest version of Spring, then you should exclude the transitive dependencies in your pom.xml for the Struts 2 Spring plugin and then declare dependency nodes to the current version of the Spring jar files. If you are using Ant and explicitly including the jar files in your application, then just include the latest version of the Spring jar files.
-
-| 
-
-In your ActionSupport class you must have a set method for the dependent object that follows standard Java bean naming conventions. If you examine the EditAction class for this tutorial's application you'll see this set method.
-
+In your `ActionSupport` class you must have a set method for the dependent object that follows standard Java bean naming conventions. If you examine the `EditAction` class for this tutorial's application you'll see this set method.
 
-~~~~~~~
+```java
 public void setEditService(EditService editService) {
-		
-   this.editService = editService;
-		
+    this.editService = editService;
 }
+```
 
-
-~~~~~~~
-
-Spring will use that set method to provide an object of type EditService to the EditAction class at run time.
+Spring will use that set method to provide an object of type `EditService` to the `EditAction` class at run time.
 
 To make our application "Spring aware" we need to add this line to web.xml.
 
 **Spring Listener In web.xml**
 
-
-~~~~~~~
+```xml
 <listener>
-	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
-
-
-~~~~~~~
+```
 
 The above code will activate the Spring framework when the application is started up by the Servlet container. By default Spring will look for a configuration file name applicationContext.xml in WEB-INF (consult the Spring documentation for how you can change where Spring looks and what the configuration file name is).
 
-#####Spring Configuration File#####
+__Spring Configuration File__
 
 In the Spring configuration file we create a bean node for those objects we want Spring to create an instance of and inject into our ActionSupport class. In the example application is this applicationContext.xml.
 
 **Spring Configuration File**
 
-
-~~~~~~~
+```xml
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -115,29 +85,22 @@ In the Spring configuration file we create a bean node for those objects we want
             http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-<bean id="editService" class="org.apache.struts.edit.service.EditServiceInMemory" />
+    <bean id="editService" class="org.apache.struts.edit.service.EditServiceInMemory" />
 
 </beans>
+```
 
+Note the id value above. By default the Spring plugin works with Spring to autowire the dependencies of the ActionClass by "name." Spring will create an object of class EditServiceMemory and provide that object to any ActionSupport class that has a setEditService method with an argument of type EditService. Consult the [Spring Plugin](//struts.apache.org/docs/spring-plugin.html) documentation for how to change the default autowire method.
 
-~~~~~~~
+The editService bean created by Spring will have a scope of singleton since that is the default scope. Consult section 3.5 of the [Spring documentation](http://www.springsource.org/documentation) for how to configure the bean definition to use a different scope (e.g. request or session).
 
-Note the id value above. By default the Spring plugin works with Spring to autowire the dependencies of the ActionClass by "name." Spring will create an object of class EditServiceMemory and provide that object to any ActionSupport class that has a setEditService method with an argument of type EditService. Consult the _Spring Plugin_  documentation for how to change the default autowire method.
+__Alternative - Have Spring Manage Creation Of ActionSupport Class__
 
-
-
-| The editService bean created by Spring will have a scope of singleton since that is the default scope. Consult section 3.5 of the [Spring documentation](http://www.springsource.org/documentation)^[http://www.springsource.org/documentation] for how to configure the bean definition to use a different scope (e.g. request or session).
-
-| 
-
-#####Alternative - Have Spring Manage Creation Of ActionSupport Class#####
-
-Using the above methodology, the Struts 2 framework will still manage the creation of the ActionSupport class. If you prefer you can configure the application so that Spring will create the ActionSupport class also. To support this technique you need to add a bean node to the Spring configuration file for the ActionSupport class.
+Using the above methodology, the Struts 2 framework will still manage the creation of the `ActionSupport` class. If you prefer you can configure the application so that Spring will create the ActionSupport class also. To support this technique you need to add a bean node to the Spring configuration file for the ActionSupport class.
 
 **Spring Configuration For ActionSupport Class Managed By Spring**
 
-
-~~~~~~~
+```xml
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -145,80 +108,27 @@ Using the above methodology, the Struts 2 framework will still manage the creati
             http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd">
             
+    <bean id="editService" class="org.apache.struts.edit.service.EditServiceInMemory" />
 
-<bean id="editService" class="org.apache.struts.edit.service.EditServiceInMemory" />
-
-<bean id="editAction" class="org.apache.struts.edit.action.EditAction" scope="prototype">
-
-	<property name="editService" ref="editService" />
-	
-</bean>
+    <bean id="editAction" class="org.apache.struts.edit.action.EditAction" scope="prototype">
+        <property name="editService" ref="editService" />
+    </bean>
 
 </beans>
+```
 
+Note in the above that there is an `editAction`�bean and its `editService`�property is set to the `editService`�bean. Since we are having Spring manage the `EditAction` class we must specify any properties of `EditAction`�that we want Spring to inject. Please remember that actions must be created on each request, they cannot be�`singletons`- this is the default `scope` that's why it must be changed to�`prototype`.
 
-~~~~~~~
-
-Note in the above that there is an 
-
-~~~~~~~
-editAction
-~~~~~~~
-�bean and its 
-
-~~~~~~~
-editService
-~~~~~~~
-�property is set to the 
-
-~~~~~~~
-editService
-~~~~~~~
-�bean. Since we are having Spring manage the 
-
-~~~~~~~
-EditAction
-~~~~~~~
-�class we must specify any properties of 
-
-~~~~~~~
-EditAction
-~~~~~~~
-�that we want Spring to inject. Please remember that actions must be created on each request, they cannot be�
-
-~~~~~~~
-singletons
-~~~~~~~
- - this is the default�
-
-~~~~~~~
-scope
-~~~~~~~
- that's why it must be changed to�
-
-~~~~~~~
-prototype
-~~~~~~~
-.
-
-In the 
-
-~~~~~~~
-struts.xml
-~~~~~~~
-�configuration file you must specify the Spring id value for the class attribute of the action node. This tells Struts to get a bean with that id value from Spring for the Action class.
+In the `struts.xml`�configuration file you must specify the Spring id value for the class attribute of the action node. This tells Struts to get a bean with that id value from Spring for the Action class.
 
 **Struts Configuration For Spring Managed ActionSupport Class**
 
-
-~~~~~~~
+```xml
 <action name="edit" class="editAction" method="input">
-	<result name="input">/edit.jsp</result>
+    <result name="input">/edit.jsp</result>
 </action>
+```
 
-
-~~~~~~~
-
-#####Summary#####
+__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.


[03/13] struts-site git commit: removed space from code block

Posted by lu...@apache.org.
removed space from code block


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/f2cb6c60
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/f2cb6c60
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/f2cb6c60

Branch: refs/heads/master
Commit: f2cb6c602d7e28f039775bf9b4467442e99491a4
Parents: 1454da1
Author: Stefaan Dutry <st...@gmail.com>
Authored: Sat Apr 1 18:03:17 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Sat Apr 1 18:03:17 2017 +0200

----------------------------------------------------------------------
 source/getting-started/processing-forms.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/f2cb6c60/source/getting-started/processing-forms.md
----------------------------------------------------------------------
diff --git a/source/getting-started/processing-forms.md b/source/getting-started/processing-forms.md
index 909a8a9..27b52fc 100644
--- a/source/getting-started/processing-forms.md
+++ b/source/getting-started/processing-forms.md
@@ -94,7 +94,7 @@ To collect the above information we'll use a Struts 2 form. When creating this f
     <s:form action="register">
 
       <s:textfield name="personBean.firstName" label="First name" />
-      <s:textfield  name="personBean.lastName" label="Last name" />
+      <s:textfield name="personBean.lastName" label="Last name" />
       <s:textfield name="personBean.email"  label ="Email"/>  
       <s:textfield name="personBean.age"  label="Age"  />