File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes How to get body-content value in my custom tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "How to get body-content value in my custom tag?" Watch "How to get body-content value in my custom tag?" New topic
Author

How to get body-content value in my custom tag?

somjet thana
Greenhorn

Joined: May 17, 2006
Posts: 7
in jsp file


How to get body-content(name) value in MyTag.doTag(), if MyTag extends SimpleTagSupport?

Thanks
Somjet
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

If you want to simply output the body :


If you want to do something with the body :


[My Blog]
All roads lead to JavaRanch
somjet thana
Greenhorn

Joined: May 17, 2006
Posts: 7
and how to get only string value of body-content in doTag()
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Call the StringWriter#toString method.
somjet thana
Greenhorn

Joined: May 17, 2006
Posts: 7
Thanks.
with jsp code


Which is the correct use of EL(${name})?

1.use ${name} to input name param to doTag()
2.use ${name} to display name when we use getJspContext().setAttribute("name", "tom")
3.all correct

thanks
somjet
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

They all sound badly written. Where did you get them from ?
somjet thana
Greenhorn

Joined: May 17, 2006
Posts: 7
it is my doubt.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get body-content value in my custom tag?