Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Servlet mapping and images/css files 1

Status
Not open for further replies.

thrybergh

MIS
Feb 10, 2003
52
GB
Hi.

I have a servlet running and normally I would map it so that when the URL is


it runs the servlet to process the form posted to it.

For convenience, we would like is so that the URL only needs to be:



I have amended the web.xml to be:

<servlet-mapping>
<servlet-name>UniSXAP</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

and it finds the servlet OK, but because I have referenced a .css file and an image also (in the HTML generated by the servlet), they are never found since the requests are always funnelled to the servlet.

Is it possible to achieve what I would like, or is it not possible to map the servlet and the other files in this way?

:)
 
Change :

Code:
 <servlet-mapping>
    <servlet-name>UniSXAP</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

to
Code:
 <servlet-mapping>
    <servlet-name>UniSXAP</servlet-name>
    <url-pattern>/servlet/UniSXAP</url-pattern>
  </servlet-mapping>

and then add below :

Code:
<welcome-file-list>
  <welcome-file>servlet/UniSXAP</welcome-file>
</welcome-file-list>

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
That's exactly what I need. It's worked a treat.


Many thanks!

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top