aspose file tools*
The moose likes JSP and the fly likes how to write an El expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to write an El expression " Watch "how to write an El expression " New topic
Author

how to write an El expression

Chidanand Chauhan
Ranch Hand

Joined: Nov 10, 2005
Posts: 77
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

Joined: Dec 06, 2004
Posts: 116
Add this line to your jsp.
<%@ page isELIgnored="false" %>


Balasubramani SD,<br />SCJP 1.4,SCWCD 1.4,SCJP 5.0<br /><a href="http://sd.balasubramani.googlepages.com" target="_blank" rel="nofollow">www.sd.balasubramani.googlepages.com</a>
Chidanand Chauhan
Ranch Hand

Joined: Nov 10, 2005
Posts: 77
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

Joined: Nov 10, 2005
Posts: 77
please tell me the above problem how to resolve this problem.
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
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

Joined: Nov 10, 2005
Posts: 77
I am using tomcat 4.1 which i suppose it doesn't support EL. Please tell me.
Balasubramani Dharmalingam
Ranch Hand

Joined: Dec 06, 2004
Posts: 116
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

Joined: Dec 06, 2004
Posts: 116
sorry use this
<c ut value="${attr[0]}"/>
instead of ${attr[0]}
Chidanand Chauhan
Ranch Hand

Joined: Nov 10, 2005
Posts: 77
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

Joined: Dec 06, 2004
Posts: 116
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

Joined: Nov 10, 2005
Posts: 77
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

Joined: Dec 06, 2004
Posts: 116
$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

Joined: Nov 10, 2005
Posts: 77
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

Joined: Dec 06, 2004
Posts: 116
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

Joined: Nov 10, 2005
Posts: 77
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

Joined: Nov 10, 2005
Posts: 77
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

Joined: Dec 06, 2004
Posts: 116
sorry replace
<%@ taglib uri="http://java.sun.com/jsp/core" prefix="c" %>
by <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to write an El expression