• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Problem with JSTL functions

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

Here is the problem: suppose i want to check whether string A contains string B.

I may use this funtion: <c:if test="${fn:contains(A, B)}">

If A is a varibles,for example,A is defined as ${param.customerName};B is a constant:tom

The funtion is converted into:

c:if test="${fn:contains('${param.customerName}', 'tom')}">

Problem occurs! The tomcat server wont get the value defined by ${param.customerName},instead,it just treat it as a constant string.

Any ideas?
[ January 11, 2007: Message edited by: Joshua Cloch ]
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

c:if test="${fn:contains('${param.customerName}', 'tom')}">



Your syntax is hosed.

The ${} notation is used to surround an entire EL expression. It's not some sort of "fetch" operator. They cannot be nested.

Remove the nested ${}.
[ January 11, 2007: Message edited by: Bear Bibeault ]
 
Joshua Cloch
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot,man!
 
reply
    Bookmark Topic Watch Topic
  • New Topic