Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Nick White Ro
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!