Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Expression Language

 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have doubt in JSP Expression Language. I tried example given on page 365 and 366 in HFSJ.

<%@ page import="foo.*"%>
<html>
<body>
<%--Normal java script code---1
<%= ((foo.Person) request.getAttribute("person")).getDog().getName()%>--%>

<%-- without java scripting -------2
<jsp:useBean id="person" class="foo.Person" scope="request" />
Dog's nam e is <jsp:getProperty name="person" property="dog"/> --%>

<!-- Using Expression Language --%>---3

Dog's name is: ${person.dog.name}
</body>
</html>


1 and 2 gives the output as expected.
However when i try to get the output using 3 i.e using EL, then i DONOT see wht is expected. I expected dog's name to be printed, however it simply prints the text i.e " Dog's name is: ${person.dog.name}"

What do i need to include in my JSP to make it work....

"
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65338
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JSP FAQ for properly setting up your web application.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks...
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like EL evaluation is ignored, make sure its not disabled in your web.xml and you can override the web.xml setting in the JSP using
<%@page isELIgnored="false" %>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65338
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Deepak Jain:
you can override the web.xml setting in the JSP using <%@page isELIgnored="false" %>
A properly set up web.xml makes this unnecessary.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks deepak for the extra info......
Thanks Bibeault for clarification....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic