Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to evaluate body content of tag?

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic