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

Clarification About c:set target= on bottom of p.447 of HFSJ Book

 
Bob Nedwor
hangman
Ranch Hand
Posts: 215
Eclipse IDE Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers;
I am having a hard time understanding what they are saying in the last part of the very last item in the black "Key Points and Gotchas with <c:set>" box. I can't get null when using a non-property in the EL, but I still get an exception, rather than a null value.

When I create the bean and use the <c:set> tag to set the property, it works fine.


This is fine because, then I get the output I expect:
We think the cats name is : Fluffy

But then when I added a line at the end of the JSP that says:
, then my app blows up with:
javax.servlet.ServletException: Unable to find a value for "junk" in object of class "CatBean" using operator "."

Thanks for any clarification as to what they are saying in this final bullet point.
 
Kevin DesLauriers
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to my notes I show that EL exceptions thrown during the evaluation of an EL expression choose to return null including when a nullpointer exception is thrown - combat this with the empty operator.

However, if a JavaBean property does not exist then an exception is thrown. That seems to jive with what you example did.

Kevin DesLauriers
 
Bob Nedwor
hangman
Ranch Hand
Posts: 215
Eclipse IDE Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But based on what they are saying at the bottom of p. 447, I should be able to generate the null, rather than throw an exception, using a non-Property under some condition, right?

I just cannot see how?
Thanks for any hints.
[ February 16, 2007: Message edited by: Bob Nedwor ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic