• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Write This Tag Handler  RSS feed

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to write a custom tag which display some default message if the body is empty or display the body if it isn't. How do I test if a body is empty in doTag()? All I have is only getJspBody().invoke(..)!!
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe there's an overloaded "invoke" method that will evaluate the body and store the result in some sort of output stream instead of sending it back to the client. At that point you can get the contents as a string, etc.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!