tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ben short" <...@benshort.co.uk>
Subject Re: Servlet Mappings
Date Tue, 31 Oct 2006 09:32:03 GMT
Many thanks for your help Charles.

On 10/31/06, Bill Barker <wbarker@wilshire.com> wrote:
>
> "ben short" <ben@benshort.co.uk> wrote in message
> news:86aa493a0610301101m22f1a118lddcc53c2877e8d69@mail.gmail.com...
> >I just tried changing the /images/* to *.jpg and it works
> >
>
> Yes, Tomcat's default servlet won't work with a prefix map.  It requires
> either a suffex map, or a default map.
>
> > On 10/30/06, ben short <ben@benshort.co.uk> wrote:
> >> Charles,
> >>
> >> Im deploying a war file. Im also using spring. I havent touched the
> >> web.xml. I have litrally downloaded and un tared the file from the
> >> apache tomcat website.
> >>
> >> Here is the layout of the test app;lication i have setup to try it out.
> >>
> >> test
> >> - images
> >>   - test.jpg
> >> - WEB-INF
> >>   - web.xml
> >>   - test-servlet.xml
> >>   - jsp
> >>     - test.jsp
> >>   - lib
> >>     - various jars
> >>   - tld
> >>     - c-1.1.2.tld
> >>     - fmt-1.1.2.tld
> >>
> >> test.jsp
> >>
> >> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> >> <html>
> >>   <head><title>Simple jsp page</title></head>
> >>   <body><img src="images/test.jpg" alt="" /></body>
> >> </html>
> >>
> >> web.xml
> >>
> >> <!DOCTYPE web-app PUBLIC
> >>  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> >>  "http://java.sun.com/dtd/web-app_2_3.dtd" >
> >>
> >> <web-app>
> >>   <display-name>Archetype Created Web Application</display-name>
> >>
> >>     <servlet>
> >>         <servlet-name>test</servlet-name>
> >>
> >> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
> >>         <load-on-startup>1</load-on-startup>
> >>     </servlet>
> >>
> >>    <servlet-mapping>
> >>        <servlet-name>default</servlet-name>
> >>        <url-pattern>/images/*</url-pattern>
> >>    </servlet-mapping>
> >>
> >>     <servlet-mapping>
> >>        <servlet-name>test</servlet-name>
> >>        <url-pattern>/</url-pattern>
> >>    </servlet-mapping>
> >>
> >> </web-app>
> >>
> >> test-servlet.xml
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
> >> "http://www.springframework.org/dtd/spring-beans.dtd">
> >> <beans>
> >>
> >>     <bean id="testController"
> >> class="org.springframework.web.servlet.mvc.ParameterizableViewController">
> >>         <property name="viewName" value="test"/>
> >>     </bean>
> >>
> >>        <bean id="urlMapping"
> >> class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
> >>            <property name="mappings">
> >>                <props>
> >>                    <prop key="/test.html">testController</prop>
> >>                 </props>
> >>            </property>
> >>        </bean>
> >>
> >>        <bean id="viewResolver"
> >> class="org.springframework.web.servlet.view.InternalResourceViewResolver">
> >>            <property name="prefix">
> >>                <value>/WEB-INF/jsp/</value>
> >>            </property>
> >>            <property name="suffix">
> >>                <value>.jsp</value>
> >>            </property>
> >>            <property name="viewClass">
> >>
> >> <value>org.springframework.web.servlet.view.JstlView</value>
> >>            </property>
> >>        </bean>
> >>
> >>
> >> </beans>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On 10/30/06, Caldarale, Charles R <Chuck.Caldarale@unisys.com> wrote:
> >> > > From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> >> > > Subject: RE: Servlet Mappings
> >> > >
> >> > > What's the directory structure under ROOT?  Is ROOT under
> >> > > your <Host>'s appBase?  For that matter, what's the
> >> > > directory structure under appBase?
> >> >
> >> > Should have mentioned that your images directory should be under ROOT,
> >> > not appBase.  If it's under appBase, images is being deployed as a
> >> > separate webapp, which is probably not your intent.
> >> >
> >> >  - Chuck
> >> >
> >> >
> >> > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
> >> > PROPRIETARY
> >> > MATERIAL and is thus for use only by the intended recipient. If you
> >> > received this in error, please contact the sender and delete the e-mail
> >> > and its attachments from all computers.
> >> >
> >> > ---------------------------------------------------------------------
> >> > To start a new topic, e-mail: users@tomcat.apache.org
> >> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> > For additional commands, e-mail: users-help@tomcat.apache.org
> >> >
> >> >
> >>
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message