wood burning stoves 2.0*
The moose likes JSP and the fly likes jsp tagdependent custom tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "jsp tagdependent custom tag " Watch "jsp tagdependent custom tag " New topic
Author

jsp tagdependent custom tag

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
I have a Bodytagsupport subclassed class with the following :
public int doAfterBody() throws JspException {

try{
JspWriter out = getPreviousOut();
BodyContent bodyContent = getBodyContent();
String thisbody=bodyContent.getString();
thisbody+="\n";
thisbody+=param;
out.print(thisbody);

}
catch(Exception e) {

e.printStackTrace();
}
return SKIP_BODY;
}
Here param is an attribute of the tag;which is to be appended to the tag body-simple,isnt it?
the JSP content is :
<table border=1 cellspacing=0 cellpadding=2>
<sample:echotag param="IBM">
<tr><td> ${firstname} </td></tr>
</sample:echotag>
</table>

In the resulting html i get IBm printed before ${firstname},why?
Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
The dostarttag is as follows:
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();

} catch (Exception e) {
e.printStackTrace();
}

return EVAL_BODY_BUFFERED;
}
 
GeeCON Prague 2014
 
subject: jsp tagdependent custom tag