Return-Path: X-Original-To: apmail-struts-commits-archive@minotaur.apache.org Delivered-To: apmail-struts-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 49E74106E4 for ; Thu, 6 Mar 2014 08:10:02 +0000 (UTC) Received: (qmail 28278 invoked by uid 500); 6 Mar 2014 08:10:02 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 27970 invoked by uid 500); 6 Mar 2014 08:09:59 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 26870 invoked by uid 99); 6 Mar 2014 08:09:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2014 08:09:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2014 08:09:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0ACD423888E2 for ; Thu, 6 Mar 2014 08:09:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r900210 [1/2] - /websites/production/struts/content/release/2.3.x/docs/ Date: Thu, 06 Mar 2014 08:09:27 -0000 To: commits@struts.apache.org From: lukaszlenart@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140306080928.0ACD423888E2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: lukaszlenart Date: Thu Mar 6 08:09:26 2014 New Revision: 900210 Log: Adds missing pages Added: websites/production/struts/content/release/2.3.x/docs/s2-020.html websites/production/struts/content/release/2.3.x/docs/version-notes-23161.html Modified: websites/production/struts/content/release/2.3.x/docs/action-configuration.html websites/production/struts/content/release/2.3.x/docs/actionmapper.html websites/production/struts/content/release/2.3.x/docs/ajax-and-javascript-recipes.html websites/production/struts/content/release/2.3.x/docs/building-struts-2-fast-track-release.html websites/production/struts/content/release/2.3.x/docs/building-struts-2-normal-release.html websites/production/struts/content/release/2.3.x/docs/building-struts-annotations.html websites/production/struts/content/release/2.3.x/docs/building-struts-master.html websites/production/struts/content/release/2.3.x/docs/cdi-plugin.html websites/production/struts/content/release/2.3.x/docs/convention-plugin.html websites/production/struts/content/release/2.3.x/docs/file-upload.html websites/production/struts/content/release/2.3.x/docs/guides.html websites/production/struts/content/release/2.3.x/docs/hello-world-using-struts-2.html websites/production/struts/content/release/2.3.x/docs/interceptors.html websites/production/struts/content/release/2.3.x/docs/migration-guide.html websites/production/struts/content/release/2.3.x/docs/one-time-steps.html websites/production/struts/content/release/2.3.x/docs/rest-plugin.html websites/production/struts/content/release/2.3.x/docs/sample-announcements.html websites/production/struts/content/release/2.3.x/docs/security-bulletins.html websites/production/struts/content/release/2.3.x/docs/struts-2-blank-archetype.html websites/production/struts/content/release/2.3.x/docs/struts-2-maven-archetypes.html websites/production/struts/content/release/2.3.x/docs/struts-2-spring-2-jpa-ajax.html websites/production/struts/content/release/2.3.x/docs/type-conversion.html websites/production/struts/content/release/2.3.x/docs/using-freemarker-templates.html websites/production/struts/content/release/2.3.x/docs/validation.html Modified: websites/production/struts/content/release/2.3.x/docs/action-configuration.html ============================================================================== --- websites/production/struts/content/release/2.3.x/docs/action-configuration.html (original) +++ websites/production/struts/content/release/2.3.x/docs/action-configuration.html Thu Mar 6 08:09:26 2014 @@ -138,11 +138,11 @@ under the License.

The action mappings are the basic "unit-of-work" in the framework. Essentially, the action maps an identifier to a handler class. When a request matches the action's name, the framework uses the mapping to determine how to process the request.

+/*]]>*/
Modified: websites/production/struts/content/release/2.3.x/docs/actionmapper.html ============================================================================== --- websites/production/struts/content/release/2.3.x/docs/actionmapper.html (original) +++ websites/production/struts/content/release/2.3.x/docs/actionmapper.html Thu Mar 6 08:09:26 2014 @@ -137,11 +137,11 @@ under the License.
+/*]]>*/
-

 

Obtain a fresh checkout of created branch.

- -

Update version of archetypes

Edit src/site/resources/archetype-catalog.xml and change version of archetypes to current $VERSION, save and commit.

Apply security patch

Apply and commit security patch.

Prepare release

Tag the release by using the "release:prepare" goal of Maven:

-

For a dry run, add '-DdryRun=true'. If you do a dry run, use 'mvn release:clean' to clean up after you have looked at the output.

When prompted for the SCM tag name, follow this pattern: STRUTS_2_3_[PATCH_VERSION]

Icon
-

For some reason, when using svn client 1.5, the release plugin might fail to tag the release, if it fails, run:
svn up -r head
mvn release:prepare -Dresume

-
-
-
- -
- Icon -
-

If you get the error message above, try to re-run mvn release:prepare -Dusername=yourSvnUsername -Dpassword=yourSvnPassword -DautoVersionSubmodules=true command again, -Dresume flag is set to true by default and the plugin will resume the release process from where it failed before.

+

If you get the error message above, try to re-run mvn release:prepare -DautoVersionSubmodules=true command again, -Dresume flag is set to true by default and the plugin will resume the release process from where it failed before.

This step will (more information):

  • Check that there are no uncommitted changes in the sources
  • Check that there are no SNAPSHOT dependencies
  • Change the version in the poms from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
  • Transform the SCM information in the POM to include the final destination of the tag
  • Run the project tests against the modified POMs to confirm everything is in working order
  • Commit the modified POMs
  • Tag the code in the SCM with a version name (this will be prompted for)
  • Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
  • Commit the modified POMs

Perform the release

@@ -201,9 +184,10 @@ mvn release:branch -DbranchName=STRUTS_#

After this step the artifacts will be hosted by Nexus

If you need to run perform again, (or in a different box), do:

-

Next, log in to Nexus and close staging repository.

Move the assemblies to the /www/people.apache.org/builds/struts/$VERSION dir

After closing repository in Nexus, check if the version is available from staging repository as below:

-
-

In the model class above note the use of public set and get methods to allow access to the private message String attribute. The Struts 2 framework requires that objects you want to expose to the view (HelloWorld.jsp) follow the JavaBean-style conventions.

- - -

Step 2 - Create The Action Class HelloWorldAction.java

-

We need an Action class to act as the Controller. The Action class responds to a user action (in this example that action will be clicking an HTML hyperlink and sending a specific URL to the Servlet container). One or more of the Action class's methods are executed and a String result is returned. Based on the value of the result, a specific view page (in this example that view page is HelloWorld.jsp) is rendered.

- -

Note the package and import statements below.

-
HelloWorld.java
- -
-

The Struts 2 framework will create an object of the HelloWorldAction class and call the execute method in response to a user's action (clicking on a hyperlink that sends a specific URL to the Servlet container).

- -

In this example, the execute method creates an object of class MessageStore and then returns the String constant SUCCESS.

- -

Note also the public set and get methods for the private MessageStore object. Since we want to make the MessageStore object available to the view page (HelloWorld.jsp) we need to follow the JavaBean-style of providing get and set methods.

- -

Step 3 - Create The View HelloWorld.jsp

-

We need a server page to present the message that is stored in the model class MessageStore. Create the below jsp in the WebContent folder (for the Ant project) and in src/main/webapp for the Mvn project).

-
HelloWorld.jsp
- -
-

The taglib directive tells the Servlet container that this page will be using the Struts 2 tags and that these tags will be preceded by s.

- -

The s:property tag displays the value returned by calling the method getMessageStore of the HelloWorldAction controller class. That method returns a MessageStore object. By adding the .message onto the messageStore part of the value attribute we are telling the Struts 2 framework to then call the getMessage method of that MessageStore object. The getMessage method of class MessageStore returns a String. It is that String that will be displayed by the s:property tag.

- -

We'll learn more about tags in the next tutorial. See the Struts Tags for more information about tags.

- -

Step 4 - Add The Struts Configuration In struts.xml

-

We need a mapping to tie the URL, the HelloWorldAction class (controller), and
-the HelloWorld.jsp (the view) together. The mapping tells the Struts 2 framework which class will respond to the user's action (the URL), which method of that class will be executed, and what view to render based on the String result that method returns.

- -

Edit the struts.xml file (in the Mvn project that file is in the src/main/resources folder) to add the action mapping. Place the action node (action name="hello") between the opening and closing package node, just after the action mapping with the name="index". Your complete struts.xml should look like:

- -
struts.xml
- -
- -

Step 5 - Create The URL Action

-

In index.jsp (see WebContent folder for Ant project and src/main/webapp for Mvn project) let's add an Action URL the user can click on to tell the Struts 2 framework to run the execute method of the HelloWorldAction class and render the HelloWorld.jsp view.

- -

First add the taglib directive at the top of the jsp <%@ taglib prefix="s" uri="/struts-tags" %>. Next add this p tag <p><a href="<s:url action='hello'/>">Hello World</a></p> after the h1 tag. Your new index.jsp should look like:

-
index.jsp
- -
-

The Struts url tag creates the URL with an action of hello. The hello action was mapped to the HelloWorldAction class and its execute method. When the user clicks on the above URL it will cause the Struts 2 framework to run the execute method of the HelloWorldAction class. After that method returns the String success, the view page HelloWorld.jsp will be rendered.

- -

Step 6 - Build the WAR File and Run The Application

-

Execute mvn clean package to create the war file.

- -

Copy the war file to your Servlet container. After your Servlet container successfully deploys the war file go to this URL http://localhost:8080/helloworld/index.action where you should see the following:
-

- -

Click on the Hello World link and you should get the HelloWorld.jsp page:

- -

- -

Getting Help

-

The Struts 2 user mailing list is an excellent place to get help. If you are having a problem getting this application to work search the Struts 2 mailing list. If you don't find an answer to your problem, post a question on the mailing list.

- - -

How the Code Works

- -

Your browser sends to the web server a request for the URL http://localhost:8080/Hello_World_Struts2_Ant/hello.action.

-
  1. The container receives from the web server a request for the resource hello.action. According to the settings loaded from the web.xml, the container finds that all requests are being routed to org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter, including the *.action requests. The StrutsPrepareAndExecuteFilter is the entry point into the framework.
  2. The framework looks for an action mapping named "hello", and it finds that this mapping corresponds to the class "HelloWorldAction". The framework instantiates the Action and calls the Action's execute method.
  3. The execute method creates the MessageStore object and returns SUCCESS. The framework checks the action mapping to see what page to load if SUCCESS is returned. The framework tells the container to render as the response to the request, the resource HelloWo rld.jsp.
  4. As the page HelloWorld.jsp is being processed, the <s:property value="messageStore.message" /> tag calls the getter getMessageStore of the HelloWorld Action and then calls the getMessage of the MessageStore object returned by getMessageStore, and the tag merges into the response the value of the message attribute.
  5. A pure HTML response is sent back to the browser.
- - - - - -

What to Remember

- -

The framework uses Actions to process HTML forms and other requests. The Action class returns a result-name such as SUCCESS, ERROR, or INPUT. Based on the mappings loaded from the struts.xml, a given result-name may select a page (as in this example), another action, or some other web resource (image, PDF).

- -

When a server page is rendered, most often it will include dynamic data provided by the Action. To make it easy to display dynamic data, the framework provides a set of tags that can be used along with HTML markup to create a server page.

- -
+

The Struts url tag creates the URL with an action of hello. The hello action was mapped to the HelloWorldAction class and its execute method. When the user clicks on the above URL it will cause the Struts 2 framework to run the execute method of the HelloWorldAction class. After that method returns the String success, the view page HelloWorld.jsp will be rendered.

Step 6 - Build the WAR File and Run The Application

Execute mvn clean package to create the war file.

Copy the war file to your Servlet container. After your Servlet container successfully deploys the war file go to this URL http://localhost:8080/helloworld/index.action where you should see the following:

Click on the Hello World link and you should get the HelloWorld.jsp page:

Getting Help

The Struts 2 user mailing list is an excellent place to get help. If you are having a problem getting this application to work search the Struts 2 mailing list. If you don't find an answer to your problem, post a question on the mailing list.

How the Code Works

Your browser sends to the web server a request for the URL http://localhost:8080/Hello_World_Struts2_Ant/hello.action.

  1. The container receives from the web server a request for the resource hello.action. According to the settings loaded from the web.xml, the container finds that all requests are being routed to org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter, including the *.action requests. The StrutsPrepareAndExecuteFilter is the entry point into the framework.
  2. The framework looks for an action mapping named "hello", and it finds that this mapping corresponds to the class "HelloWorldAction". The framework instantiates the Action and calls the Acti on's execute method.
  3. The execute method creates the MessageStore object and returns SUCCESS. The framework checks the action mapping to see what page to load if SUCCESS is returned. The framework tells the container to render as the response to the request, the resource HelloWorld.jsp.
  4. As the page HelloWorld.jsp is being processed, the <s:property value="messageStore.message" /> tag calls the getter getMessageStore of the HelloWorld Action and then calls the getMessage of the MessageStore object returned by getMessageStore, and the tag merges into the response the value of the message attribute.
  5. A pure HTML response is sent back to the browser.

What to Remember

The framework uses Actions to process HTML forms and other requests. The Action class returns a result-name such as SUCCESS, ERROR, or INPUT. Based on the mappings loaded from the struts.xml, a given result-name may select a page (as in this example), another action, or some other web resource (image, PDF).

When a server page is rendered, most often it will include dynamic data provided by the Action. To make it easy to display dynamic data, the framework provides a set of tags that can be used along with HTML markup to create a server page.

Modified: websites/production/struts/content/release/2.3.x/docs/interceptors.html ============================================================================== --- websites/production/struts/content/release/2.3.x/docs/interceptors.html (original) +++ websites/production/struts/content/release/2.3.x/docs/interceptors.html Thu Mar 6 08:09:26 2014 @@ -143,11 +143,11 @@ under the License.

Many Actions share common concerns. Some Actions need input validated. Other Actions may need a file upload to be pre-processed. Another Action might need protection from a double submit. Many Actions need drop-down lists and other controls pre-populated before the page displays.

The framework makes it easy to share solutions to these concerns using an "Interceptor" strategy. When you request a resource that maps to an "action", the framework invokes the Action object. But, before the Action is executed, the invocation can be intercepted by another object. After the Action executes, the invocation could be intercepted again. Unsurprisingly, we call these objects "Interceptors."