This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

EL issue in HFSJ

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try
 
Chip Post
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My pleasure. I'm a big fan of keeping unnecessary goop off the pages.
 
A magnificient life is loaded with tough challenges. En garde tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic