• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing Parameters into custom tags

 
Reggie McDougal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I page variable into my custome tags from a JSP


<catalogue:bottom_nav page="ProductDefList.jsp" rowCount="<%= rowCount%>" searchtext="<%=searchtext%>" searchby="<%=searchby%>" />


It returns literal rowCount="<%= rowCount%>" and if I remove the "" the tag is not recognised.

Can some one give me a heads up

Reg
 
Nandkishore Dhilde
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using scriplets you should use following way

keep ur variables in pageContext

<catalogue:bottom_nav page="ProductDefList.jsp" rowCount="${rowCount}" searchtext="${searchtext}" searchby="${searchby}" />

and keep ur varaibles <rtexprvalue>true</rtexprvalue> in *.tld file defination

and in catalogue tag's doStartTag method write this code for all evaluting variables
rowCount= ExpressionUtil.evalNotNull("rowCount",
"rowCount", rowCount, Object.class, this, pageContext);

hope this will solve ur problem...

Nandkishore
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using scriplets you should use following way


That would work only with JSP 2.0 and only if the variables were scoped variables rather than scripting variables.

First thing to check is the TLD for the custom tag to see if it allows run-time expressions to be specified for those attributes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!