This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Custom tags - setting an attribute using <jsp:attribute> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Custom tags - setting an attribute using <jsp:attribute>" Watch "Custom tags - setting an attribute using <jsp:attribute>" New topic
Author

Custom tags - setting an attribute using <jsp:attribute>

Nick White Ro
Greenhorn

Joined: Jan 27, 2010
Posts: 15
Let's say I have a custom tag library:



This is the "showDate" tag class:



This is what I use in a JSP:



This works just fine. The "date" attribute value is passed as a Date object to the setter in the tag class.
BUT if I use <jsp:attribute> to specify the "date" attribute value, it is passed as a String object, so an exception is thrown: Cannot convert "Sun Feb 28 19:26:25 EET 2010" for the attribute date of the bean java.util.Date.
This is the synthax I used:



I haven't found in the specs anything which states that the <jsp:attribute> tag will ALWAYS return a String.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom tags - setting an attribute using <jsp:attribute>
 
Similar Threads
SimpleTagSupport class
JSP EL not working
Help with custom tags
question on rtexprvalue
Simple Tag with Attribute