On Mon, Apr 21, 2008 at 2:43 PM, Andy Clark <[EMAIL PROTECTED]> wrote:
> 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

I do this with servlets. In my webapps, all the URLs are handled by
servlets, not JSPs (so all the complicated logic is in Java, and JSPs
are used to display the results). Every servlet has to end with a
forward to a JSP file, and that's where it selects the JSP based on
the current style. Like this:

        String someJSPFile = [whatever];
        RequestDispatcher rd = request.getRequestDispatcher(someJSPFile);
        rd.forward(request, response);

If you've already implemmented the guts of the app in JSP pages, you
could use a small servlet (or filter or JSP) just as a "gateway" to
select which JSP to call.
-- 
Len

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to