tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bucanek <>
Subject Re: Newbie problem with JSP contexts & virtual hosts
Date Tue, 13 Apr 2004 06:07:11 GMT
While I didn't get any suggestions or feedback on my original question, I believe I've found
a solution.  Now I just need to run it by the group to see if it's "Kosher."

James Bucanek wrote on Sunday, April 11, 2004:
>  <!-- Virtual host: -->
>  <!-- (jlb 11-April-2004) Added virtual host -->
>  <Host name="" debug="0" appBase="/Users/darkthirty/Sites"
>        unpackWARs="false" autoDeploy="true">
>    <!-- Context for the top-level web application -->
>    <Context path="" docBase="." debug="99" reloadable="true"/>
>  </Host>


>    <web-app>
>        <display-name>darkthirty</display-name>
>        <description> artwork application</description>
>        <!-- Global parameters for this web application -->
>        <context-param>
>            <param-name>test</param-name>
>            <param-value>Some Value</param-value>
>        </context-param>
>    </web-app>

The basic problem with this arrangement is that my JSP pages ran in the context of the 'jsp'
<servlet> that's defined in ${CATALINA_HOME}/conf/web.xml for the default <Host>,
not the Context that I defined in my web-app that I want to run in my virtual <Host>.

So, it occurred to me that I could create may own instance of the JSP engine as my <Servlet>.
 Now that I have a <Servlet> to reference, I can then map all of the *.jsp files in
my virtual host to that:

        <description> artwork application</description>
        <!-- Global parameters available to all web applications -->
            <param-value>Some Value</param-value>
        <!-- The mapping for the JSP servlet -->

This seems to work just great.  The Manager sees my application (by name), and all of the
context parameters appear in my JSP pages.

As far as I can tell, there doesn't seem to be anything really "bad" about this solution.
 Except that I end up with a new instance of the JspServlet for each virtual host, which is
probably a tolerable amount of overhead.

My question is this: Is this the "right" way to accomplish this?

James Bucanek       <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message