• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom Tag

 
Paul Yule
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is about when one creates a custom tag. If the <rtexprvalue> is set to true for a particular attribute and you send an object via EL "${sumthing}" you must use ExpressionEvaluatorManager.evaluate(blah, blah...) inside the doTag(). My question is why. Just looking for a plain english answer. Thanks for any interest.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you must use ExpressionEvaluatorManager.evaluate(blah, blah...) inside the doTag().


No, you don't. The EL will be evaluated by the JSP engine before it is passed to the tag.

If this is not working for you, you have a configuration issue. Please see the JSP FAQ for proper setup of JSP 2.0 web applications.
[ May 13, 2008: Message edited by: Bear Bibeault ]
 
Paul Yule
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
perhaps it is because I'm stuck with an old version of the JSP spec? Debugging showed that "${stuffz}" was being sent as a string literal as opposed to <% int j = 5; pageContext.setAttribute("stuffz", j);%> and being sent as "5". If that isn't the case and it isn't required, Why does it exist at all? Especially if setStuffz() is enough in the tag.
[ May 13, 2008: Message edited by: paul yule ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, what version of JSP are you using? The EL cannot be used natively prior to JSP 2.0.
 
Paul Yule
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.2 or something. Don't have the code on hand and was just my curiousity wondering why it wouldn't pass EL appropriately for custom tags but was just peachy for other stuff. It is my understanding that when it comes across the custom tag it loads the class definition and sets values at the class level. Then it goes to any attributes defined for the tag and, in order, sets their values using the corresponding javaBean spec setter. It would make sense to me that it could evaluate the EL before it is sent to the customTag setter. JSP 2.0 allows this then?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic