I want to write a custom struts2 tag,which has a separate action class for itself, and can be called from different jsp pages.
Something like:
<s:writetext type="aaa" parentid="xxx" parentname ="yyy" height ="50" width ="125" />
Is it possible? Please help, I'm very new to this and googling about this didn't help.
Thanks, Aditya
This old question became also relevant for me this week when reviewing some existing code. Apart from tbruyelle's answer, this was for me the most helpful reference:
http://bodez.wordpress.com/2009/03/13/customising-struts2-jsp-tags/
In summary(1),
org.apache.struts2.views.jsp.ui.TextFieldTag
)org.apache.struts2.components.TextField
)/core/src/main/resources/template
)The struts 2 API could also be helpful.
Unfortunately (and surprisingly), there is very little documentation about how to do this, and the javadoc for the existing struts components is "a bit scarce" and misleading. Perhaps it is not intended to be used this way?
(1) I have edited this answer a few years after the original post to add this summary, aligning the answer with SO guidelines. Unfortunately, it's been a long time without working with similar code, and I cannot be sure to have kept the essence of the linked blog, so please refer to the link if it still works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With