Wiki source code of Struts2 Tag Guide
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | The first place to look for tag information should always be the //[[Tag Reference>>url:http://struts.apache.org/2.3.1.2/docs/tag-reference.html]]// at struts.apache.org. | ||
2 | |||
3 | There are five categories of Struts2 tags (which can be clearly seen in the above mentioned Tag Reference): | ||
4 | |||
5 | 1. Data | ||
6 | 1. Form | ||
7 | 1. Control | ||
8 | 1. Non-Form UI | ||
9 | 1. Ajax | ||
10 | |||
11 | **Data** tags are used to output data to a Java Server Page (JSP). Typical uses include displaying values collected by the action and displaying links to other actions. | ||
12 | |||
13 | **Form** tags can display data like Data tags as they can supply a default value, but are used to render html form elements. **Note**: Struts2 Form tags render using a //theme, //so if you find it difficult to lay out the page as you would expect I would recommend //[[changing the theme to //simple//>>doc:Struts2 Themes]]//. | ||
14 | |||
15 | **Control** tags cover: conditions, iteration and tags that manipulate collections. | ||
16 | |||
17 | **Non-Form UI** tags allow you to display action messages, errors for fields or for the action and let you render custom components that you have made in other JSPs, freemarker or velocity. | ||
18 | |||
19 | **Ajax** tags: **DON'T USE THEM**. They have been [[deprecated>>url:http://struts.apache.org/2.2.3/docs/ajax-tags.html]]. People hearing this decide that the Struts2 jQuery Tag library is the way to go. This too is generally not a good idea, the most flexible solution is to use JavaScript along with the struts2-json-plugin. This needs a larger discussion and will be covered at a later date. | ||
20 | |||
21 | |||
22 | == Guide to Implementing your own Struts2 Tags == | ||
23 | |||
24 | Here is a useful example implementing a Struts2 tag: [[http:~~/~~/joshuajava.wordpress.com/2008/12/27/creating-custom-components-with-struts-2/>>url:http://joshuajava.wordpress.com/2008/12/27/creating-custom-components-with-struts-2/]] | ||
25 | |||
26 | [**In progress**] |