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

EL issue in HFSJ

 
Chip Post
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try
 
Chip Post
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not have to pollute your pages with the directive. Is you web app set up properly as outlined in the JSP FAQ?
 
Chip Post
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My pleasure. I'm a big fan of keeping unnecessary goop off the pages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic