permaculture playing cards*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Accessing Tag Body in Classic Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Accessing Tag Body in Classic Tag" Watch "Accessing Tag Body in Classic Tag" New topic
Author

Accessing Tag Body in Classic Tag

Giju George
Ranch Hand

Joined: Jun 08, 2004
Posts: 333
How do I access the tag body in a classic tag. I have tried :-

BodyContent bc=getBodyContent();
System.out.println("Body Content1 :- "+bc);


and also


System.out.println("Body Content1 :- "+bodyContent);


inside the doStartTag() and doEndTag(). But in both cases it returns null . My tag extends BodyTagSupport. Do I have to implement any other method ???


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCEA
Paul Croarkin
Ranch Hand

Joined: Sep 30, 2004
Posts: 106
Try:

BodyContent body = getBodyContent();
JspWriter out = body.getEnclosingWriter();
out.print(body.getString());


Thanks,<br /> <br />Paul Croarkin<br />SCEA 5, SCWCD, SCJP
 
wood burning stoves
 
subject: Accessing Tag Body in Classic Tag