| Author |
EL issue in HFSJ
|
Chip Post
Greenhorn
Joined: Jul 16, 2007
Posts: 7
|
|
I'm attempting to re-create the EL example in HFSJ, pg. 368. I've had success with all examples in the chapter up til now, but can't figure out why my EL is not working .
The servlet code works in retreiving the dog's name, but the EL doesn't work.
Here's my JSP:
<html><body>
<%= ((net.chippost.Person) request.getAttribute("person")).getDog().getName() %>
Dog's name is: ${person.dog.name}
</html></body>
and here's my output:
barney Dog's name is: ${person.dog.name}
As you can see, the servlet code works, but the EL statement is not executed.
Anyone else have this issue, or any ideas?
Thanks in advance... chip
"I am not young enough to know everything."
- Oscar Wilde
|
 |
Chip Post
Greenhorn
Joined: Jul 16, 2007
Posts: 7
|
|
as a postscript...re the following result.jsp
<html><body>
Dog's name is:
<%= ((net.chippost.Person) request.getAttribute("person")).getDog().getName() %>
Dog's name is:
<jsp:useBean id="person" class="net.chippost.Person" scope="request" />
<jsp:getProperty name="person" property="dog" />
Dog's name is:
${person.dog.name}
</html></body>
the scriptlet works, and the useBean returns the object...WHY doesn't the EL work?
Dog's name is: barney
Dog's name is: net.chippost.Dog@358d81
Dog's name is: ${person.dog.name}
"Arguments are to be avoided; they are always vulgar and often convincing."
- Oscar Wilde
|
 |
cesar valencia
Ranch Hand
Joined: Oct 14, 2008
Posts: 33
|
|
try
|
scjp5, scwcd5
|
 |
Chip Post
Greenhorn
Joined: Jul 16, 2007
Posts: 7
|
|
nevermind...
<%@ page isELIgnored="false" %>
fixed my problem.
Dog's name is: barney
Dog's name is: net.chippost.Dog@daea8a
Dog's name is: barney
But I thought EL was ENABLED by default?
Regards...chip
"Always forgive your enemies; nothing annoys them so much."
- Oscar Wilde
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56531
|
|
|
You should not have to pollute your pages with the directive. Is you web app set up properly as outlined in the JSP FAQ?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Chip Post
Greenhorn
Joined: Jul 16, 2007
Posts: 7
|
|
much abliged. The newer web.xml declaration worked without the page directive.
- chip
"Consistency is the last refuge of the unimaginative."
- Oscar Wilde
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56531
|
|
|
My pleasure. I'm a big fan of keeping unnecessary goop off the pages.
|
 |
 |
|
|
subject: EL issue in HFSJ
|
|
|