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

HFS pg 447 doubt.

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,

HFS pg. 447, key point and gotchas for the <c:set>

If the "target" expression is a bean, but the bean does not have a property that matches "property", the Container throws an exception. But be careful, because the EL expression by itself will NOT cause an exception, if the property doesn't exist.



Why NOT ? EL will not forgive u for this...

if i do something like this:
${fooBean.notAProperty}
it WILL cause me an exception. Tested this with Tomcat5.0.28 also. There was an exception.

am i missing something, or is it an error in the book here ?

Regards,
Gaurav.
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's another possibility that Tomcat is not doing what it should be.

I agree with you, though, that something bad happens in Tomcat when using the dot operator on something thats not there. In some code I had open, I changed "${listElement.shipComment}" to "${listElement.nonExisting}" and it blew sky-high:

Servlet.service() for servlet jsp threw exception javax.servlet.jsp.el.ELException: Unable to find a value for "nonExisting" in object of class "xabookstore.entity.Item" using operator "."

--Dale--
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
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