tags:

views:

839

answers:

4

Hello All...

I am developing my application using spring-web-mvc...

Now at my Controller it returns like this :

  public class InterfacesManageController implements Controller {
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception  {

    Map<String, Object> myModel = new HashMap<String, Object>();

    myModel.put("interfacesList", this.interfacesSecurityProcessor.findByAll(0, null, null, null));

    return new ModelAndView("common", "model", myModel);
}

Now, my JSP contains following code :

<c:forEach items="${model.interfacesList}" var="prod">
     <c:out value="${prod.id}"/> <c:out value="${prod.name}"/><br><br>
</c:forEach>

Now when i am executing this to Windows platform where i have tomcat 6.0.20, ognl 2.6.11 it's giving me exact output which i want like :

117 eth1

118 eth1

119 eth0

But, when i am deploying war file in unix (cent os) platform, where i have tomcat 5.5, the ognl expression doesn't get executed and giving me output like :

${prod.id} ${prod.name}

Can anybody have solution, what should be the problem with ognl expression version and tomcat version ?

Thanks in advance...

A: 

Are you sure that you have included JSTL library either on Tomcat or your Web Application's lib folder?

These links will help you:

How to set up Tomcat to work with JSTL

How to reference and use jstl in your web application

kgiannakakis
If JSTL wasn't installed you should have seen *nothing* in the visual output and everything (unparsed/unevaluated) in the HTML source.
BalusC
I do have JSTL in my classpath.. That's why i am getting output in windows with tomcat 6.0.20.. I am sure...
Nirmal
It would not have worked if JSTL was in classpath of Tomcat 6.0, but not in the classpath of Tomcat 5.5. You apparently have it, or it is in the classpath of the webapp, then it would have worked on all environments. But OK, as said this is not the root cause of the problem here.
BalusC
+7  A: 

But, when i am deploying war file in unix (cent os) platform, where i have tomcat 5.5, the ognl expression doesn't get executed and giving me output like :

${prod.id} ${prod.name}

With other words, the EL expression doesn't get evaluated? That can have one or more of the following causes:

  1. Application server in question doesn't support JSP 2.0.
  2. The web.xml is not declared as Servlet 2.4 or higher.
  3. The @page is configured with isELIgnored=true.
  4. The web.xml is configured with <el-ignored>true</el-ignored> in <jsp-config>.

Tomcat 5.x is Servlet 2.4/JSP 2.0, so 1) can be scratched. You didn't change anything in webapp before deploying I assume, so 3) and 4) can be likely scratched. Now left 2). Maybe you declared it as Servlet 2.5 for Tomcat 6.0 while the Tomcat 5.x only understands up to with Servlet 2.4. This way everything will become a mess. Redeclare web.xml as Servlet 2.4 and it should work in both Tomcat 5.x and 6.x. The declaration should look like:

<web-app
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <!-- Here you go. -->

</web-app>
BalusC
Got the solution BalusC.... Thanks a lot for your answers... Actually i was declaring Servlet 2.5 for my tomcat 6.0.20. As you told me, i have changed it to Servlet 2.4, everything is working fine...
Nirmal
You're welcome.
BalusC
A: 

I had this same problem and solved it too by changing the web.xml version to 2.4. Thanks so much, it was doing my head in!

Jamie
You're welcome :) In the future, please post comments as comments by `add comment` link. Don't post them as answers. You're free to just upvote the answer if you like it. Also see http://stackoverflow.com/faq. Happy StackOverflowing!
BalusC
A: 

Hi, I change the servler version to 2.4 on the header of Web.xml but not work

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

on my computer run fine, but on the server show EL expresion ${user.firstname} ${user.lastname}.

on my computer I installed tomcat 5.5 with JDK 6, and run fine,

any other idea what is my problem. I have all this lib, maybe I need another lib.

standard.jar jstl.jar

Gabriel
Hi, welcome at Stackoverflow. Do not post questions as answers. Post questions as questions by pressing `Ask Question` button at the right top. Feel free to include links to topics you found in search, but didn't help in solving the problem. Don't forget to include details about the server make/version.
BalusC