This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Author

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?

yamini/.
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
 
Consider Paul's rocket mass heater.
 
subject: How to evaluate body content of tag?
 
Similar Threads
dostartTag return value doubt
Doubt regarding Custom tags
Doubt Enthuware Mock Exam
jwebplus question
regarding custom tags