aspose file tools*
The moose likes JSP and the fly likes Custom tags to override jsp include action and @include directive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Custom tags to override jsp include action and @include directive" Watch "Custom tags to override jsp include action and @include directive" New topic
Author

Custom tags to override jsp include action and @include directive

sandeeprajsingh tandon
Ranch Hand

Joined: Mar 06, 2009
Posts: 74
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: 1027
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: 61764
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom tags to override jsp include action and @include directive