Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL: EL is not working  RSS feed

 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I tried to send value for 'selectedOption' attribute to Custom Tag (typeCode is the tag)



but inside Tag, its getting value for 'selectedOption' as "<c ut value='${model.gender}'/>" instead of resultant of '${model.gender}' expression.

I use Tomcat 4.0, using Any clue?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot use one action (tag) as the attribute value of another action (tag).
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are using Tomcat 4, which is not a JSP 2.0 container, you are kind of stuck. You will not be able to use the EL to fetch a value to use as the attribute of an action.
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply. Even I can't get it working on Tomcat 5.0 too. Any solution to get around this.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure your application uses Servlet2.4 defined deployment descriptor, web.xml.

Moreover, by default the JSP EL is disabled for Web Applications that use a
web.xml file as defined by Servlets 2.3.
[ May 10, 2005: Message edited by: Adeel Ansari ]
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah I've tried with Servlet 2.4 version but its the same. Any idea?
 
Erwin Bredford
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i had that problem solved it today .
i copied the jstl.jar from netbeans 4.0 and standard.jar from apache
and used this this supports El
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

replace with the ones u have and restart
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chinedu,

You mean to say copy of
(1) jstl.jar from Netbeans 4.0
(2) standard.jar from Apache (like Tomcat 4.0)

together made working for you. But how different is this jstl.jar from Tomcat's jstl.jar.
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally...I got it working.

Here we go,

Just need to add-in following piece of code in the custom tag.

JSP is something like,


<d:typeCode dropDownType="GENDER" selectedOption="${model.gender}" htmlOption="LABEL"/>


and use ExpressionEvaluatorManager to translate the selectedOption
with something like


String arg=(String) org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate
("selectedOption", selectedOption, String.class, this, pageContext);


It works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!