Hello,

I am having trouble getting my c:param working. I've looked all around the web for a solution. Here's some of the code that I have:

test.jsp

<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" language="java" errorPage="" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
</head>
<body>
<c:import url="test2.jsp" >
    <c:param name="testVar" value="0" />
</c:import>
</body>
</html>

test2.jsp

<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" language="java" errorPage="" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
</head>
<body>
hello
${param.testVar}
</body>
</html>

Here is what is printing.

hello ${param.testVar}

I was expecting "hello 0" to print. Any help would be greatly appreciated.

Thank you

Recommended Answers

All 3 Replies

The code is fine. It seems that the EL is not evaluating in the webserver. The reasons for these may be,
1] Your web.xml should does not have reference to web-app_2_4.xsd schema or higher
e.g.

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

2] You might have disabled the EL in either jsp or web.xml
In JSP you can disable by the configuring @page with isELIgnored=true.(Which doesnt seems to be the case looking at the code snippet posted)
Or
In web.xml it is configured with <el-ignored>true</el-ignored>

Also there could be a remote possibility of conflicting jar files

Hope this helps

Thanks so much, Parry. I added isELIgnored="false" to the @page and it is working fine. Now on to other problems. :)

A better option would be for you to configure the same in your web.xml file so that:
* changes can be applied to all the JSP files with a single configuration
* changing the configuration amounts to just changing the web.xml file and not each and every JSP

Also, if this thread has served your purpose, please mark it as solved using the "Mark this thread as solved" link above the quick reply box.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.