Last modified by Ken McWilliams on 2012/03/10 01:50

From version Icon 6.1 Icon
edited by Ken McWilliams
on 2012/03/03 23:27
Change comment: There is no comment for this version
To version Icon 8.1 Icon
edited by Ken McWilliams
on 2012/03/10 02:40
Change comment: There is no comment for this version

Summary

Details

Icon Page properties
Content
... ... @@ -1,4 +1,4 @@
1 -I think every struts2 user should be using the conventions plugin. It reduces xml to almost nothing, speeds up development time and improves readablility. I really can't think of a down side. There is a very simple example, for detailed information on the struts2-conventions-plugin see the [[struts2 site>>url:http://struts.apache.org/2.1.6/docs/convention-plugin.html]].
1 +Every Struts2 user should be using the conventions plugin. It reduces xml configuration to almost nothing, speeds up development time and improves readability. There is really no reason not to use it. For detailed information on the struts2-conventions-plugin see the [[struts2 site>>url:http://struts.apache.org/2.1.6/docs/convention-plugin.html]].
2 2  
3 3  Starting with an [[empty Struts2 project>>doc:Setting up a new Struts2 Project in Netbeans]].
4 4  
... ... @@ -6,15 +6,16 @@
6 6  
7 7  Using the conventions plugin is very easy!
8 8  
9 -It forms a relationship between your packages and the JSPs under WEB-INF (you can use other view technology but in this example we'll use JSPs).
9 +It forms a relationship between your packages and the JSPs under //WEB-INF// (you can use other view technology but in this example we'll use JSPs).
10 10  
11 11  == **Basic Rules you must obey when using conventions** ==
12 12  
13 -* Packages are scanned for "action", "struts" or "struts2" when such a package is found all Classes which implement ActionSupport or end with the name "Action" become actions.
14 -* The package structure after "action", "struts" or "struts2" become part of the name space for the action.
15 -* JSPs for the root namespace are found under /WEB-INF/content other name spaces are added as folders under content.
16 -* JSPs under /WEB-INF/content automatically become actions even if there is no corresponding action class.
17 -* Action Classes will follow Java standard naming, that is camel case and the JSPs will be all lower case with hyphens between words.
13 +* Packages are scanned for "action", "struts" or "struts2". When such a package is found all Classes which implement ActionSupport or end with the name "Action" become actions.
14 +* Action Classes follow Java standard naming practices. That is the classes are written in camel case.
15 +* The JSPs which act as the view for an action class will be all lower case with hyphens between words.
16 +* The package structure after "action", "struts" or "struts2" become part of the name space for the action. Packages which follow become struts2 namespaces.
17 +* JSPs for the root namespace are found under ///WEB-INF/content// other name spaces are added as folders under content.
18 +* JSPs under// /WEB-INF/content// automatically become actions even if there is no corresponding action class.
18 18  
19 19  == **Examples** ==
20 20  
... ... @@ -96,4 +96,6 @@
96 96   </body>
97 97  </html>
98 98  
99 -**That's it run the project and test it with** http:~/~/localhost:8080/Example/enter-name to input a value or supply a get request by using the url, such as: http:~/~/localhost:8080/Example/process-form?name=Ken
100 +**That's it! Run the project and test it with** __http:~/~/localhost:8080/Example/enter-name__
101 +
102 +To input a value or supply a get request by using the url, such as: __http:~/~/localhost:8080/Example/process-form?name=Ken__