This old question has become relevant for me this week, when some existing code is being reviewed. Apart from tbruyelle's answer , this was the most useful link for me:
http://bodez.wordpress.com/2009/03/13/customising-struts2-jsp-tags/
In short (1) ,
- Extend an existing tag (e.g.
org.apache.struts2.views.jsp.ui.TextFieldTag ) - Extend your behavior (e.g.
org.apache.struts2.components.TextField ) - Define a new theme and templates (for example, copy and edit an existing theme in
/core/src/main/resources/template ) - Create a new TLD for a customized version of taglib
- Deploy it in a web application
struts 2 API can also be useful.
Unfortunately (and surprisingly), there is very little documentation on how to do this, and the javadoc for existing location components is a bit leaner and misleading. Perhaps it is not intended to be used in this way?
Notes
(1) I edited this answer a few years after the initial post to add this summary, matching the answer with SO recommendations. Unfortunately, this was a long time without working with similar code, and I cannot be sure that I have retained the essence of the linked blog, so please refer to the link if it still works.
source share