• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Passing Parameters into custom tags

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67682
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

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.
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic