This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jstl-c length of a string in c:if test  RSS feed

 
Joe Busch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to test the length of a string field using the expression langauage?

The following line does not recognize the length() call:
c:if test="${displaybean.UserName.length() le 30}"

Thanks in advance.
Joe
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following line does not recognize the length() call


Right. You can't make function calls in the EL.

If you are using JSTL 1.1 there's a length function in the fn group to obtain the length of an element. For JSTL 1.0, you need to provide the length to the page as a separate scoped variable.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!