aspose file tools*
The moose likes JSP and the fly likes Expression Language does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Expression Language does not work" Watch "Expression Language does not work" New topic
Author

Expression Language does not work

Jasmine Zhao
Greenhorn

Joined: Oct 01, 2004
Posts: 8
Hi,

I just tried the following code and tomcat did not understand the EL part.

Could anybody tell me what I did wrong and missed out? I have tomcat 5 and Java 1.4 installed.

Jsp code
==========================================
<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://jakarta.apache.org/taglibs/core" %>
<jsp:useBean id="now" class="java.util.Date" />

<html>
<head>
<title>Test Me</title>
</head>

<body>
<c ut value="${pageContext.request.method}" /> <br>
<% out.println ("Request user Name [" + request.getParameter("userName") +"]"); %> <br>
<c ut value="${now}" /> <br>
1+2+3 = ${1+2+3} <br>
<%out.println(now);%>
</body>

</html>

Result Page:
=====================================
${pageContext.request.method}
Request user Name [null]
${now}
1+2+3 = ${1+2+3}
Fri Oct 01 13:55:42 EDT 2004
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Do you have your web app declared as a Servlet 2.3 or 2.4 web app in your web.xml file? If you declare it as Servlet 2.4 app, the EL will be automatically "turned on" on your pages.

As an aside:
<%out.println(now);%>


Why on earth are you using out.println() in your JSPs?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jasmine Zhao
Greenhorn

Joined: Oct 01, 2004
Posts: 8
Thanks a lot. I did what you told me and it works now.

I used <%out.println(now);%> just to verify if the old things were still working. You know if things don't work, you suspect everything.

Anyway, thanks again.

Jas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Expression Language does not work
 
Similar Threads
error message
c:out JSTL tag of the core libaray of general purpose
Spring with JSTL the expresion c:out value="${result}" not working
JSP fails to read POST parameters
Problem with File Upload