Trouble with c:out in jstl

I am trying to use JSTL but it is not working very well.For instance, <c:out value="${4+4}"/> writes out 4+4instead of 8. Any idea what is going on?Message was edited by: tanitm
[218 byte] By [tanitma] at [2007-11-26 18:03:42]
# 1

One highly possible reason is that the EL is not evaluating.

EL - expression language is whatever is inside ${.... }

One of the main reasons why EL doesn't evaluate is if the configuration is not set up properly.

You didn't mention which version of JSTL, I'm assuming JSTL 1.1

For JSTL 1.1 , your Webserver (a.k.a container) should be based on Servlet 2.4 spec, check the following

1) servlet.jar version should be 2.4 or higher - look for the version inside the Manifest.MF file inside the jar file

2) web.xml should conform to the servlet 2.4 version, so inside your web.xml make sure you have the following exactly as it appears below:

<web-app version="2.4"

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">

3) Check your taglibrary directive inside the JSP file, it should be as follows if you are using JSTL 1.1

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

All of the above checks are for JSTL 1.1 , for previous versions of JSTL 1.0 the solution is different.

If you are using JSTL 1.0 I recommend that you upgrade it to 1.1 as , 1.1 is significantly better.

Message was edited by:

appy77

appy77a at 2007-7-9 5:33:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...