Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom tags to override jsp include action and @include directive

 
sandeeprajsingh tandon
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think its a little strange requirement but
i have a 1000 jsp files that use jsp:include and @include for including other jsps.
Now, i want to make it possible for these functionalities to have dynamic jsp paths.
i.e jsp:include path="<%=DynamicPath%>/test.jsp", where DynamicPath will be available only at request time. This it seems is not possible as per the documentation of jsp:include
It would be too much work to go into 1000 files, change the path attribute to point to an expression and declare that expression in the jsp.

I thought i could create a custom tag for Myjsp:include where i could add path to the page attribute in my tag and then call the jsp:include from with in that.

Could anyone provide me a pointer on that?.

thanks
sandeepraj
 
Stefan Evans
Bartender
Posts: 1751
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Possible for <jsp:include> tags.
Not possible for @Include directive which is resolved at compile time.

Consider using an EL expression such as ${dynamicPath} rather than a scriptlet expression.
I would try to stick with the <jsp:include> rather than customising it. Global search and replace refactoring tools should do a pretty good job in this case - provided its a relatively simple change.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a run-time problem. If the editing tools you are using make it hard to make these sorts of changes across multiple files, you need better tools, not a custom tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic