• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why is custom tag not producing any output?

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have created a custom tag. The code follows. Despite the fact that I verified through log statements that the doAfterBody is called and returns a value, nothing is output to my JSP page. Any ideas for troubleshooting further?

Java class ...


JSP invocation:


TLD:


Thanks, - Dave
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why aren't you basing your tag on SimpleTagSupport rather than "classic" BodyTagSupport.


(where "classic" means "we didn't deprecate it, but it's just too complex and cantankerous to deal with, so we completely replaced it with something else").
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SimpleTagSupport doesn't support custom tags that have JSP body-content. I am open to another implementation but the question is still unanswered.

- Dave
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But it does support "scriptless" bodies--isn't that good enough?
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dave,

Why are you overriding the setBodyContent() method, this is not needed. Furthermore the body content is usually written to the page like this:

Regards,
Frits
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To David's question,

I can't guarantee that the body-content will not contain EL expressions. However, even when it contains text (per the example in the original post)å



I'm getting the error that follows ...




The new code I have is

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, yeah; you'd have to change the TLD to be "scriptless", not JSP. But I think one or both of us is missing something--that doesn't mean the body can't contain EL or JSP:TLD (probably screwed up--more or less from memory and crappy examples on web)Tag implOutput
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In any case--why not use JSP 2.0 JSP-based tags? For something as simple as this that isn't really doing much it sure seems easier.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can lead the horse to water ...
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David, Per your suggestion (thanks for the helpful example), I changed the body-content to "scriptless" instead of "JSP" and everything worked.

I actually don't know anything about JSP 2.0 tags so didn't know to ask about them. I will see how they can be used with reference to my example.

Thanks, -
 
reply
    Bookmark Topic Watch Topic
  • New Topic