Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL expression not returning value what i want

 
Aman Lucky Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I want to make my own tag for <c:forToken>


the code below is tag handler class

but the output is
${name}
${name}
${name}
${name}
thanks.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2447
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

How does the structure of your web-app look like? Where is the .tld file located?

When you debug your code does it hit the setters of your Tag handler class?
 
Aman Lucky Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my c1.tld file which is located outside the WEB-INF folder along with .java file


<short-name>c</short-name>
<tag>
<name>forTokens</name>
<tag-class>my6.ForToken</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>items</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>delims</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

</taglib>

I just want to print name written in items by using EL expression by my own tagHandler class

but if i am using <%= pageContext.getAttribute("name") %> in place of ${name} it print out correct output

thanks for your reply Frits sir

but give me reason why it is printing ${name} in place of name of items
 
Aman Lucky Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i know about EL expression that when evaluating the expression ${name}, the container will look for name in the page, request, session, and application scopes and will return its value

when i have tried to write <%@ page isELIgnored ="false" %> in jsp file it return output what i want but why it is ignoring EL expresion .Is default value of EL is true

it will be greatefull to you to give me some knowledge on it
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the ServletFAQ and JspFAQ -- if the EL is not being evaluated, you're web.xml is likely misconfigured.

You should not have to use the directive.
 
Aman Lucky Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks

I have change the web.xml now it is working

my web.xml is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

Actually i had copy this from JSTL but why it is not accepting EL expression is there any reason
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the FAQ pages -- you need to declare the web.xml as moderne version of servlets. 2.3 is too old.
 
Aman Lucky Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it

thanks for your response
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic