• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to write an El expression

 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
i am facing a very silly mistake can anyone figure out.

my jsp code is

<%
String[] names={"Chidanand","Aman","Saurabh","Rinku","Hardeep"};
request.setAttribute("attr",names);

%>
The names for the zeroth index is: ${attr[0]}




Now its not working ...... can anyone tell me whether i am correct or not. means is it correct to call the zeroth index of the string is by ${attr["0"]}
please tell me
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add this line to your jsp.
<%@ page isELIgnored="false" %>
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balasubramani Dharmalingam:
Add this line to your jsp.
<%@ page isELIgnored="false" %>


when i use this expression in my jsp it gives the Error message.

org.apache.jasper.JasperException: /second.jsp(4,0) Page directive has invalid attribute: isELIgnored
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please tell me the above problem how to resolve this problem.
 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which Server you are using?, check it out whether it supports JSP 2.0 from its Docs.If using Tomcat, try to use Tomcat 5.5.

Shrinivas
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using tomcat 4.1 which i suppose it doesn't support EL. Please tell me.
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat 4.1 supports JSP 1.2, In JSP1.2 there is no attribute "isELIgnored" for page directive it is added from JSP 2.0 only.

So use this
<c ut val="${attr[0]}"/>
instead of ${attr[0]}

In JSP2.0 complained servers(eg.Tomcat 5.X) u can use like
<%@ page isELIgnored="false" %>

Attrbute vale is ${attr[0]}.
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry use this
<c ut value="${attr[0]}"/>
instead of ${attr[0]}
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No i tried nothing comes up in the out put. even the error hasn't comeup this time nor the output came.
Please help me
I struck i dont understand what to do.............
cant proceed forward in HFSJ.
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do u have jstl.jar and standard.jar in lib folder of application..?

If no means just copy these two jars from
$CATALINA_HOME/webapps/jsp-examples/WEB-INF/lib to
$CATLAINA_HOME/webapps/<your-application>/WEB-INF/lib
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balasubramani Dharmalingam:
do u have jstl.jar and standard.jar in lib folder of application..?

If no means just copy these two jars from
$CATALINA_HOME/webapps/jsp-examples/WEB-INF/lib to
$CATLAINA_HOME/webapps/<your-application>/WEB-INF/lib


Hi balasubramani.

I dont have jstl.jar and standard.jar in lib forlder i can't understand the cataline home could you tell me little wider so that i can find the two files and store at their respective place.
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
$CATALINA_HOME >>> where u have installed tomcat.

Example: c:\tomcat\

and add the below line to ur jsp.

<%@ taglib uri="http://java.sun.com/jsp/core" prefix="c" %>
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balasubramani Dharmalingam:
do u have jstl.jar and standard.jar in lib folder of application..?

If no means just copy these two jars from
$CATALINA_HOME/webapps/jsp-examples/WEB-INF/lib


the path C:\Tomcat 4.1\webapps
after this jsp-example folder is not in my dir structure. Instead of jsp-example. I have example folder. but if i follow the path through web-inf then i dont have the lib folder.
Please tell me what to do
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get it from here http://www.axint.net/apache/java-repository/jstl/jars/jstl-1.0.jar
http://www.axint.net/apache/java-repository/taglibs/jars/standard-1.0.jar
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi bala

I stored into the respective dir structure but the out put hasn't come up event the error is not their
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This time it gives the error.
Error is :

This absolute uri (http://java.sun.com/jsp/core) cannot be resolved in either web.xml or the jar files deployed with this application
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry replace
<%@ taglib uri="http://java.sun.com/jsp/core" prefix="c" %>
by <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic