wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in Expression Language Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in Expression Language" Watch "Doubt in Expression Language" New topic
Author

Doubt in Expression Language

Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
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....

"


Man Suraj
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

See the JSP FAQ for properly setting up your web application.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
thanks...
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
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" %>


SCJP, SCWCD, SCBCD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

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

Joined: Dec 20, 2007
Posts: 299
Thanks deepak for the extra info......
Thanks Bibeault for clarification....
 
jQuery in Action, 2nd edition
 
subject: Doubt in Expression Language