Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to intercept JSTL and Struts Tag Behavior

 
William Nielsen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am faced with an interested design issue. In a JSP page, I need to write out a special text string along with the "name" attribute for JSTL and Struts logic tags (e.g., c:if, c:when, etc...) for all start and end tags.
So, for example:

Should render the following when displayed:


How would I override/intercept the JSTL and Struts tag logic in order to inject/override the (I assume) doStartTag / doEndTag logic? I've been googling and thinking about this for days to no avail. Please help!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't. You'd need to write a custom tag to do that. This is trivial in JSP 2.0+.

Why would you need to do this?
 
William Nielsen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:You don't. You'd need to write a custom tag to do that. This is trivial in JSP 2.0+.

Why would you need to do this?


I am integrating a search engine with an app that uses custom tags as well as JSTL and Struts tags for presentation logic. What I need is the search engine index task to "see" what the expression name is for all tags so I can have the search engine "remember" who should see a text blurb or not. In other words I don't want the index task to index "Text A" for someone who isn't supposed to see "Text A". My plan was to have a index 'super user' ID that evaluated to "true" for the custom tags but write out a comment or reserved text before and after the tags so the index engine remembers what security tag governs that block.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I still really don't understand. It sure seems like this is something that should be done on the server side, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic