You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Goyal, Ritu (Ritu)" <ri...@avaya.com> on 2004/06/08 18:15:25 UTC

Issue with one level for url and images loading

Hello,

 

Our team has been trying to resolve this issue for a while now, with no
results. We are trying to keep our url short, i.e. only up to one level.

e.g. http://localhost:8080/app

We don't want the url to have the following formats

http://localhost:8080/app/servlet/app

 

We did manage to get to one level, but then are images don't load at
all. The images directory is under C:\jakarta-tomcat-4.1.27\webapps\app.

To access an image we do the following in our velocity templates.

<img src="images/logo-smaller.gif" width="123" height="44">

 

Our web.xml file has the following data.

 

<!-- ==================== Servlet Configuration ========================
-->

    <servlet>

        <servlet-name>

            app

        </servlet-name>

 

        <servlet-class>

            <!-- Must use this class if using Turbine (at least for
Turbine 2.1) -->

            org.apache.turbine.Turbine

        </servlet-class>

 

        <init-param>

            <param-name>properties</param-name>

 

            <!-- This is relative to the docBase -->

            <param-value>

                /WEB-INF/conf/TurbineResources.properties

            </param-value>

        </init-param>

 

    </servlet>

 

    <!-- ==================== Mapping Configuration
======================== -->

    <!-- Explicity allow the servlet to prevent invoker exploits -->

    

    <servlet-mapping>

        <servlet-name>app</servlet-name>

        <url-pattern>/*</url-pattern>

    </servlet-mapping>

 

We have tried almost everything, and can't get this to work. The images
work fine the minute we get our url to be
http://localhost:8080/app/servlet/app.

Is there a way around this? We also tried using Context in server.xml
and that did not work either.

 

<Context path="app" docBase="/" debug="0"

                 reloadable="true" crossContext="true">

          

</Context>

 

Will appreciate any help!!

Ritu..


Re: Issue with one level for url and images loading

Posted by QM <qm...@brandxdev.net>.
On Tue, Jun 08, 2004 at 10:15:25AM -0600, Goyal, Ritu (Ritu) wrote:
: We did manage to get to one level, but then are images don't load at
: all. The images directory is under C:\jakarta-tomcat-4.1.27\webapps\app.
: 
: To access an image we do the following in our velocity templates.
: 
: <img src="images/logo-smaller.gif" width="123" height="44">

Here's the catch: a servlet has no (predictable) "relative path", so you
can't use a relative path to the images.

I don't know whether Velocity and JSTL mix, but there's a JSTL tag (I
forget which) that returns a context-relative URI -- i.e. for links and
images.  You could check that out.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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