Wiki source code of Struts2 Tag Guide

Last modified by Ken McWilliams on 2012/04/05 01:21

Hide last authors
Ken McWilliams 1.1 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
Ken McWilliams 2.1 8 1. Non-Form UI
Ken McWilliams 1.1 9 1. Ajax
10
Ken McWilliams 2.2 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.
Ken McWilliams 1.1 12
Ken McWilliams 2.2 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]]//.
Ken McWilliams 1.1 14
Ken McWilliams 2.2 15 **Control** tags cover: conditions, iteration and tags that manipulate collections.
Ken McWilliams 2.1 16
Ken McWilliams 2.2 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.
Ken McWilliams 2.1 18
Ken McWilliams 4.1 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.
Ken McWilliams 5.1 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**]