Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to evaluate Expression Language

 
Sumit Tiwari
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have started developing some samples using EL and JSTL.

I am using Tomcat 6 and Eclipse Helios ,I have evaluated an Expression Language which is not coming properly.
Is there any external file needed to evaluate the Expression Language. For JSTL which jar is needed.

I am attaching all my source file for more clarity.

web.xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="Your_WebApp_ID"
version="2.5">
<display-name>
ELSample</display-name>
<servlet>
<description>
</description>
<display-name>
ELServlet</display-name>
<servlet-name>ELServlet</servlet-name>
<servlet-class>
com.tcs.servlets.ELServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ELServlet</servlet-name>
<url-pattern>/ELServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>


index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="<%=getServletContext().getContextPath() %>/ELServlet">
<input type="submit" value="El Sample"/>
</form>
</body>
</html>

service method

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
Person p =new Person();
p.setName("Sumit");
request.setAttribute("person", p);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/Result.jsp");
dispatcher.forward(request, response);
}

Result.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
My Name is : {person.name}
</body>
</html>

If am putting
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Name is : {person.name} change to ${person.name}

EL (<= click)
 
Sumit Tiwari
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Seetharaman !

I am working on HTL5 but my intestest is more in J2EE tech.Recently completing OCJP6 ,moving towards SCWCD 5.
I am using HF book for reference.
Any other suggestions for preparing SCWCD .
As I am currently working on Mobile Web App,I didnt more time in weedays to read.So I am using only weekends to study .
:)

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic