You could use a javax.servlet.Filter apparently, and say redirect requests
to a particular servername to /jsp_a and redirect the rest to /jsp_b.

basically installing a filter which does the following:

public void doFilter(request,response,chain) {
      if(request.getServerName.equals("server1") {
            request.getRequestDispatcher("/jsp_a" + request.getRequestURI
()).forward(request,response);
      } else {
            request.getRequestDispatcher("/jsp_b" + request.getRequestURI
()).forward(request,response);
      }
}

I can't comment if that's the correct way to do it as I'm a little bit new
to filters.

You'd declare it in your web.xml as

<filter>
  <filter-name>foobar</filter>
  <filter-class>com.whatever.MyFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>foobar</filter-name>
  <url-pattern>*</url-pattern>
</filter-mapping>

On 2/10/06, Lothar Krenzien <[EMAIL PROTECTED]> wrote:
>
>
> "Tomcat Users List" <users@tomcat.apache.org> schrieb am 10.02.0615:14:51:
> >
> > Duplicate your classes, one copy in each webapp
>
>
>
> Of course I did it. But I hoped there is a better way ?
>
>
>
>
>
> >
> > Lothar Krenzien a écrit :
> >
> > >Hi,
> > >
> > >I'm not sure whether it is possible or not:
> > >
> > >I have a webapp which I want to access under different URL's with
> different JSP's but the same java classes. I know that I can define the
> context URL in the context.xml But how to define which jsp's to use ?
> > >
> > >Example :
> > >
> > ><Context path="/a" docBase="/myapp">
> > >
> > ></Context>
> > >
> > ><Context path="/b" docBase="/myapp" >
> > >
> > ></Context>
> > >
> > >In myapp I may have a folder jsp_a and jsp_b.  Path 'a' should use JSPs
> from jsp_a and path 'b' should JSPs from jsp_b. Of course I can set up two
> different webapps. But the java classes and so the the content of the
> WEB-INF/classes directory will be identically for both webapps. I'm using
> Tomcat 5.5 under Windows 2003.
> > >
> > >Thanks,
> > >Lothar
> > >______________________________________________________________
> > >Verschicken Sie romantische, coole und witzige Bilder per SMS!
> > >Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ______________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to