• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to have output of tag handler processed by struts tag handlers?  RSS feed

 
Steve Line
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There -

I have written a custom tag handler that outputs a struts tag like this:



However the struts html:link tags aren't being processed by struts tag handlers, they are appearing literally at the browser. When I view-source from the browser I see this, exactly what my tag handler output:



How do I get the output of my custom tag handler to be processed by struts? I want the following output at the browser:



Thanks for the help. You guys on this site do a great job of answering questions.

Steve
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't do that.

Tags are converted to code when the JSP is translated. Tags are executed when the JSP runs. Tags emitted at that time have no opportunity to be translated.

So, struts or otherwise, you can't emit tags from your tags (and by "tags" here I don't mean template text tags like HTML -- but rather what the JSP Spec call "actions").
[ July 18, 2005: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But... if you are using a JSP 2.0 container, it is possible to embed custom actions (tags) in tag files.
 
Steve Line
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear, you're great.

I have done that with tag files, that's sort of what led me to think I could do it with classic tag handlers.

What's the best Book for this type of stuff? Serious JSP stuff, not just a glossing over?

Steve
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have done that with tag files, that's sort of what led me to think I could do it with classic tag handlers.


The big difference is that the contents of the tag files are available at translation time and can be converted to code as one would expect. Strings that you will be emitting at run-time to the output stream are only known at run-time, long after the translation phase.

What's the best Book for this type of stuff? Serious JSP stuff, not just a glossing over?


To tell you the truth, I learned everything I know about JSP 2.0 from the JSP 2.0 Spec. Not the easiest of reads, but it's the bottom line.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!