Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL and empty keyword  RSS feed

 
Greg Werner
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On my jsp (how) can I access a method which happens to be named isEmpty()
e.g. ${bean.empty}

This code was written way before anyone considered using jstl, so it is not attempt to override jstl. It is pervasive (that is in an interface that is implemented all over the place). What I want is as follows:

Say I have a complex type with many attributes. isEmpty returns whether or not each each field contains an empty or default value say null for any attribute or "" for String or -1 for BigDecimal or possibly even another complex type with its empty representation.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what it is you are actually asking.

No, you can't use the notation ${bean.empty} as empty is a reserved word. But a property named empty can be accessed using the notation: ${bean['empty']}.

I'm not sure if that helps you though -- your post is confusing. You talk about a bean property named empty, but then go on to talk about testing individual fields. I don't see how a bean-level property ties in with the individual fields.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!