struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Telmo Costa" <telmo.co...@ef.pt>
Subject RE: Creating custom struts 2 tags
Date Mon, 09 Apr 2007 16:25:21 GMT
Hi, 

That was exactly my first approach: I copied Date and DateTag to my own
package, and renamed them to Date2 and Date2Tag just for testing. I also
changed the annotation to @StrutsTag(name="date2", tldTagClass="my.Date2Tag"
...). It compiled fine, but when I try to use it in a jsp, it throws
"javax.servlet.ServletException: /pages/example/Format.jsp(42,2) No tag
"date2" defined in tag library imported with prefix "s"". I couldn't
understand yet how the annotation works, so can you tell me what is wrong?

Tks

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: segunda-feira, 9 de Abril de 2007 17:16
To: Struts Users Mailing List
Subject: Re: Creating custom struts 2 tags

--- Telmo Costa wrote:
> I've been searching for documentation on how to
> create a custom tag for struts2, but I haven't 
> succeed. Can you tell me where to find a tutorial or
> give me some guidelines on that subject?

They're just like any other custom tags.

Are you referring specifically about how to pull OGNL
values like the S2 tags do?

I'd probably start by looking at the source of
org.apache.struts2.components.Date, since it does what
you want (but for dates :)

I'm guessing if you extend Component you're a *long*
way through the process already; getting the value
appears to be as easy as calling findValue(valueName)
and doing what you need to with it.

That's a good idea for a quick tutorial though; if I
have time I'll add something tonight.

d.



 
____________________________________________________________________________
________
Finding fabulous fares is fun.  
Let Yahoo! FareChase search your favorite travel sites to find flight and
hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message