GeeCON Prague 2014*
The moose likes JSP and the fly likes Custom Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Custom Tag " Watch "Custom Tag " New topic
Author

Custom Tag

Paul Yule
Ranch Hand

Joined: May 12, 2008
Posts: 229
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

Joined: Jan 10, 2002
Posts: 61315
    
  66

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Yule
Ranch Hand

Joined: May 12, 2008
Posts: 229
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

Joined: Jan 10, 2002
Posts: 61315
    
  66

Well, what version of JSP are you using? The EL cannot be used natively prior to JSP 2.0.
Paul Yule
Ranch Hand

Joined: May 12, 2008
Posts: 229
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?
 
GeeCON Prague 2014
 
subject: Custom Tag