If what you REALLY want to do is make your webapp be able to access resources outside 
of the webapp structure, and if you want to be non-J2EE, then you can write your own 
implementation of a JNDI DirContext, and allow it to find resources any way that you 
want.  You just have to register that DirContext implementation using the <Resources> 
element for your context...

I've done this very thing to allow my Tomcat development environment to access 
jsp/html/css/etc files from MANY different locations outside of the webapp structure.  
It works great for a development environment where all of your resources aren't in the 
shape of a webapp, but you want to be able to have a context running against them as 
you work... ;)

Dave Keyes

-----Original Message-----
From: Ming Zhao [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 05, 2003 1:00 PM
To: Tomcat Users List
Subject: Re: JSP's in other directories


You use JK2 as the connector between Apache and
Tomcat? If so, you can map your jsp in the
workers2.properties. Still I have a question: how can
you set the main directory of your page files and call
Tomcat to deal with jsp files under your main
directory?

--- Erik Price <[EMAIL PROTECTED]> wrote:
> 
> 
> Nicholas J Campbell wrote:
> > Hi,
> >     I have a question, I want to be able to access
> JSP pages that
> > are outside of the web-inf directory setup by
> tomcat...I do not know how
> > to do it, obviously. I have Apache 2 installed and
> use that at my main
> > server and then am running tomcat for the purposes
> of Servlets and JSP's
> > and I want to know what I have to do to make
> myself be able to access a
> > jsp page that is in a directory like c:\site
> 
> You should generally be able to refer to resources
> in your site by using 
> a path relative to the context.  For instance, I
> have the following site 
> structure:
> 
> /MyApp
>   index.jsp
>   main.jsp
>   others.jsp
>   /WEB-INF
>    /classes
>     /com
>      /ptc
>       /myapp
>        SomeClass.class
>        OtherClass.class
>        /server
>         SomeServlet.class
>         OtherServlet.class
>    /lib
>     somejar.jar
> 
> To access one of my JSPs from another JSP, I just
> use a relative path in 
> the "HTML" part of the JSP.  To forward to one of my
> JSPs from a 
> servlet, I use the following line of code:
> 
>    String TARGET_JSP = "/main.jsp";
> 
>    javax.servlet.ServletContext sc =
> this.getServletContext();
>    javax.servlet.RequestDispatcher rd =
>                      
> sc.getRequestDispatcher(TARGET_JSP);
>    rd.forward();
> 
> That's one way to do it, even though the servlet is
> in 
> /MyApp/WEB-INF/classes and the JSP is in /MyApp.
> 
> 
> 
> Erik
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

---------------------------------------------------------------------
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]

Reply via email to