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

set the custom tag variable  RSS feed

 
Krishna Srinivasan
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to get the variable from custom tags to jsp page??
for setting the variable i used TagExtraInfo method.
but i want to use that variable in jsp page....
Thanx.....
 
Steve Olson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must first create your TEI (TagExtraInfo) class, then register it in the TLD (tag library descriptor), finally, add the tag to the page context within doStartTag() using "setAttribute(getId(), this);"
Hope this helps ...
--Steve
---------------------------------------------
Sample TEI class ... that creates scripting variable matching the "id" attribute in the tag. Make sure "id" is a required attribute in TLD.
---------------------------------------------
import javax.servlet.jsp.tagext.*;
public class YourTEIClass extends TagExtraInfo{
public VariableInfo[] getVariableInfo(TagData value) {
return new VariableInfo[]{
new VariableInfo(value.getId()
, "YourFullyQualifiedTagClassName"
, true
, VariableInfo.NESTED)
};
}
}
---------------------------------------------
disclaimer: I didn't attempt to compile above code ... but it is from an actual working example with some edits ...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!