Jeremy's post is the best HOWTO I've seen... There's also the source code for all the existing tags which you can use as reference material.

L.

lbastil wrote:
Is there any complete Howto or Tutorial right now on this issue?
Should be really of interest ...

Thank you,
Basti



Jeromy Evans - Blue Sky Minds wrote:
Varun Narang wrote:
Hello all,
I want to get started with the customzied tag writing for Struts2.
I was able to find out ftl files for corresponding HTML elements.
Actually, I want to start writing tags which are integrated with ExtJS
library.
One of the developers recently mentioned they is writing a document about how to do this and I think there was talk about creating a maven archetype.

In the mean-time, try following some of existing code. The current version of the struts2 yui plugin provides a nice simple example as it only contains two tags and is packaged as a a plugin (http://code.google.com/p/struts2yuiplugin/source).

I find it's easiest to follow that example completely - use the maven plugin to generate the TLD and package your tags as a struts2 plugin. This isn't mandatory though as you can write the TLD by hand and include the classes in your webapp directly.

In general:
1. create a bean that extends UIBean or ClosingUIBean (for open & close tags), identifies the templates and populates the template context 2. create a tag class that extends AbstractUITag that creates the bean instance and sets the properties of the bean
 3. create the templates referenced by the bean

After completing these 3 steps you can start using your tag if you write a TLD and include it in your classpath. If you copy the pom.xml from the example able you can use maven to generate the TLD (if you've used the appropriate annotations).

The remaining steps allowing your tags to be uses within freemarker and velocity templates (rather than only JSP)

4. Create a TagLibrary and TagModels for Freemarker and Directive's for velocity
 5. Create struts-plugin.xml that declares your TagLibrary bean

Hope that helps,
regards,
Jeromy Evans
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to