File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes How to evaluate body content of 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 "How to evaluate body content of tag?" Watch "How to evaluate body content of tag?" New topic

How to evaluate body content of tag?

yamini nadella
Ranch Hand

Joined: Apr 13, 2004
Posts: 257
Tag handler has methods like doStartTag, doEndTag...etc.
If doStartTag return other than SKIP_BODY then body will be evaluated. But here my question is which method eveluates that body.

assume if tag in JSP is like
<prefix ata>select * from employee where emp_id=992</prefix ata>

Here in Tag Handler I want to execute this sql statement and return values. how can I do this process in Tag Handler? what is the method to read the body content? like the above if there are attributes in the tag How can I read them? is there anything like getAttribute()...etc?

Ritesh Agrawal
Ranch Hand

Joined: Jan 08, 2004
Posts: 74
Hi Yamini,

In order to process the body content, you have to subclass the class javax.servlet.jsp.tagext.BodyTagSupport

This class provides methods like doAfterBody(), doInitBody(), getBodyContent() etc to process the body content (i.e the content within the start and end tags).

Hope it helps.

Ritesh<br /> <br />SCJP 1.4<br />IBM Test 340<br />IBM AIX V4.0 Certified Professional<br /> <br />Right actions for the future are the best apologies for wrong ones in the past.<br />- Tyron Edwards
I agree. Here's the link:
subject: How to evaluate body content of tag?
It's not a secret anymore!