Shouldn't you be able to do this with most of the web frameworks out there (like struts, spring MVC, etc). Many of them work by forwarding all requests to an "action" servlet. The servlet then decides what action to perform and what jsp to forward the request to. Is there a reason why you can't use one of those frameworks and extend the "action" servlet to forward the request to the correct jsp?
-----Original Message----- From: Andy Clark [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 1:44 PM To: users@tomcat.apache.org Subject: Re: Bending Jasper to My Will Pid wrote: > Andy Clark wrote: >> I want Jasper to look for JSP and Tag files in a >> specific location (e.g. based on a request param); >> and then fall back to a default location if the >> file is not found. This would be extremely useful >> for skinning a webapp. > > Cascading Style Sheets are an even more useful, > practical and easier to implement solution for > skinning a webapp. > > Failing that, programmatically customising the HTML > output of a common set of tag files would be easier. CSS and DHTML only applies to the client-side and does not allow server-side customizations. We need to go beyond simple color changes or even changing the HTML layout; we need to be able to override any or all tags and JSP files in parallel. In other words, multiple versions of the code is deployed and we want to control which application code to use based on the user's settings. Our application allows users to host multiple domains and different user levels, each of which can have a different skin. And we currently allow simple changes to color, etc via CSS. But if the skin author wants to change the functionality or layout, they must modify the base JSP files/tags. Which means that *all* of the skins see the changes. Not what we want. For our customers, it is important to be able to brand each skin independently and even control which features are exposed via the interface. And we have no way of knowing all the different ways in which the customer wants to modify the application. And... they should be able to do all of this without modifying the web.xml file. So what I would like to be able to do (transparently from the user) is to, on a request-by-request basis, determine which tags/JSP files to use based on that user's skin preference. For example, if the user's skin is set to "Foo", then I want to look for tag and JSP file overrides in the skins/Foo/ directory and use those; if I don't find them there, I want to fallback and use the tags/JSP files in the default directory. I'll use a more precise example. Say that I have the following files in my webapp: WEB-INF/tags/view.tag WEB-INF/tags/button.tag skins/Foo/tags/view.tag skins/Bar/tags/button.tag with these contents: <%-- file: WEB-INF/tags/view.tag --%> <h1>Hello World</h1> <my:button text='Click Me' /> <%-- file: WEB-INF/tags/button.tag --%> <%@ attribute name='text' required='true' %> <button>${text}</button> <%-- file: skins/Foo/tags/view.tag --%> <h1>Welcome to Clicky McClicker's Clicktastic Emporium</h1> <my:button text='Clickity Click' /> <%-- file: skins/Bar/tags/button.tag --%> <%@ attribute name='text' required='true' %> <a href='#'>${text}</a> If there are three users whose skin preference is set to <undefined>, Foo, and Bar, respectively, then the interface they see is completely different when the JSP they hit uses <my:view /> in the page. User 1 sees: <h1>Hello World</h1> <button>Click Me</button> User 2 sees: <h1>Welcome to Clicky McClicker's Clicktastic Emporium</h1> <button>Clickity Click</button> User 3 sees: <h1>Hello World</h1> <a href='#'>Click Me</a> In essence, I need to control Jasper internally to do two things: 1) resolve all requests for tag/JSP files at the requested location to look for the same file in the user's skin directory; and 2) failing to find the file in the first location, try again at the default location. I hope this sheds some more light on what I need to do. And I really hope there are some Jasper experts on the list that can point me in the right direction (even if it means patching the Jasper source). > Customising a web app by implementing different sets > of tag files seems like the hardest possible route. True, but it's what I need to do. Unless there's some other JSP trick that I'm missing... -AndyC --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---------------------------------------------------------------------- The information contained in this transmission is intended only for the personal and confidential use of the designated recipients named herein. If the reader of this transmission is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this transmission in error, and that any review, dissemination, distribution, or copying of this transmission is strictly prohibited. If you have received this communication in error, please notify the sender and return and delete the original transmission immediately. Thank you. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]