• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in Setting boolean bean property from a JSP page  RSS feed

 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I'm finding problem in setting a boolean bean property.

Pls. consider the following code fragment:



This always prints false.
Can somebody point out the error in the above code?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The string 'Boolean.valueOf("true")' will evaluate to false.

Hint, hint.
[ December 24, 2006: Message edited by: Bear Bibeault ]
 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,
Thanks for the post.
But I still didn't get it. Couuld you throw some light on this.
I also tried value="Boolean.valueOf(true)" but this also resulted in false.

Thanks,
Reema
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, let's take it from another angle, if your value clause were:



you'd expect the value to be the string "xyz", right?

Same with:



right?

But what about:



Would you expect 7? Or the string "3 + 4"?

The JSP translator has no way of knowing that the string in the quotes is meant to be an expression to be evaluated unless you tell it. So how would you go about letting the JSP translator know that it's an expression?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!