Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
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
 
Marshal
Posts: 67425
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67425
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67425
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic