Some struts2 labels were used in the previous demo, using struts2.2.1.1.
Struts2 labels are often used with OGNL (Graphic object Navigation language. The following is a summary:
1. Required jar packages for struts2 labels
The struts2 tag can be divided into data tag, control tag, form tag, AJAX tag, and so on. To use these tags, you must add the following jar packages to the web project:
Commons-codec-1.6.jar
Commons-fileupload-1.2.1.jar
Commons-io-1.3.2.jar
Commons-logging-1.1.1.jar
Freemarker-2.3.16.jar
Ognl-3.0.jar
Struts2-core-2.2.1.1.jar
Struts2-dojo-plugin-2.2.1.1.jar
Xwork-core-2.2.1.1.jar
The struts2-dojo-plugin-2.2.1.1.jar contains the struts2 ajax topic template, the others are required by struts2.2 jar package
2. struts2 labels and filters
The struts2 tag can be used only in the requested resources (jsp or action view) filtered by the strtus2 core filter. Therefore, to use the struts2 tag on a jsp page that does not return a view as an action, you must configure web. xml to make the struts2 filter valid for all requests:
[Html]
<Filter-mapping>
<Filter-name> struts2 </filter-name>
<Url-pattern>/* </url-pattern>
</Filter-mapping>
<Filter-mapping>
<Filter-name> struts2 </filter-name>
<Url-pattern>/* </url-pattern>
</Filter-mapping> 3. ajax tag
If ajax tags are used, in addition to referencing the struts tag Library at the beginning of the jsp page:
<% @ Taglib prefix = "s" uri = "/struts-tags" %>
In addition, you also need to add
<S: head theme = "ajax"/> (the subsequent ajax labels use the s prefix)
Or add a reference to the dojo tag Library at the beginning of the page.
<% @ Taglib prefix = "sx" uri = "/struts-dojo-tags" %> (ajax labels on the subsequent page use the sx prefix)
4. Limitations of the struts2 tag Library
The struts2 tag library is not omnipotent. For example, it is difficult to use multiple combobox tags with different names in a form. If necessary, you must write your own js implementation.