| Author |
Custom tags to override jsp include action and @include directive
|
sandeeprajsingh tandon
Ranch Hand
Joined: Mar 06, 2009
Posts: 66
|
|
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
Joined: Jul 06, 2005
Posts: 1002
|
|
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
Joined: Jan 10, 2002
Posts: 56157
|
|
|
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.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Custom tags to override jsp include action and @include directive
|
|
|