You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hua Hou <hu...@handango.com> on 2003/04/21 23:23:29 UTC

include jsp from another context (directory)?

All, 

I have the following directory structure:

ROOT/B/b.jsp 
ROOT/C/c.jsp. 

Inside c.jsp I have a line <jsp:include page="/B/b.jsp"/>

The following URL works fine:
http://localhost/C/c.jsp


Now, going into production, I want the URL to be
http://C.mycompany.com/c.jsp, 

So I created the following mapping in server.xml
      <Host name="C.mycompany.com" debug="0" appBase="webapps/ROOT" 
       unpackWARs="true" autoDeploy="true">
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="C_log." suffix=".txt"
	        timestamp="true"/>
          <Context path="" docBase="C" debug="0"/>
      </Host>

Now the line <jsp:include page="/B/b.jsp"/> gives me problem. 
First, /B/b.jsp does not exist under the context "C". 
Second, Even I create another context"B" as in <Context path="B" docBase="B"
debug="0"/>, /B/b.jsp still can't be found.
Third, creating another context is not a solution for me, because as I know,
sessions can't be shared across contexts.

Any idea?

Thanks.

Hua

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: include jsp from another context (directory)?

Posted by Tim Funk <fu...@joedog.org>.
I think your out of luck because the Servlet (and JSP) spec doesn't like that 
type of access.

-Tim

Hua Hou wrote:
> All, 
> 
> I have the following directory structure:
> 
> ROOT/B/b.jsp 
> ROOT/C/c.jsp. 
> 
> Inside c.jsp I have a line <jsp:include page="/B/b.jsp"/>
> 
> The following URL works fine:
> http://localhost/C/c.jsp
> 
> 
> Now, going into production, I want the URL to be
> http://C.mycompany.com/c.jsp, 
> 
> So I created the following mapping in server.xml
>       <Host name="C.mycompany.com" debug="0" appBase="webapps/ROOT" 
>        unpackWARs="true" autoDeploy="true">
>         <Logger className="org.apache.catalina.logger.FileLogger"
>                  directory="logs"  prefix="C_log." suffix=".txt"
> 	        timestamp="true"/>
>           <Context path="" docBase="C" debug="0"/>
>       </Host>
> 
> Now the line <jsp:include page="/B/b.jsp"/> gives me problem. 
> First, /B/b.jsp does not exist under the context "C". 
> Second, Even I create another context"B" as in <Context path="B" docBase="B"
> debug="0"/>, /B/b.jsp still can't be found.
> Third, creating another context is not a solution for me, because as I know,
> sessions can't be shared across contexts.
> 
> Any idea?
> 
> Thanks.
> 
> Hua
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org