• Post Reply Bookmark Topic Watch Topic
  • New Topic

setting var attribute in classic custom tag  RSS feed

 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
i am writing a custom tag for some string functions like below

<stringFunctions:contains baseString="yy" stringToCompare="XXyy" />

the above tag will return a boolean say true or false. in above scenario it is true.

Then i will use the build in tage <c:if test="${XXX}">. In the place of XXX i need to pass the value returned by the <stringFunctions>...
How can i acheive this???

can i have some var attribute in my custom tag which will hold the boolean value(as a String) and use that var in the place of XXX....
if so how can i populate that var attribute...

or is there any better way to do this...
Any help would be appreciated..
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set a scoped variable with the boolean value using setAttribute() on the appropriate scoped.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi bear,
Thanks for your reply.

I want to set the the output as variable, and then use it in the c:if

say <string:Fn var="result" attr1="" attr2="" />

<c:if test="${result}"/>

in this case setting the scoped variable wont help am i right. And that too var attribute is dynamic one.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Parameswaran Thangavel:

in this case setting the scoped variable wont help


Why not?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!