HTTP Status 404

Discussions

Web tier: servlets, JSP, Web frameworks: HTTP Status 404

  1. HTTP Status 404 (2 messages)

    I am new to the jsp/servlet world. I am having a problem as follows

    This is the directory structure that I have on the system -
    /usr/local/tomcat/webapps
    /usr/local/tomcat/webapps/site1
    /usr/local/tomcat/webapps/site1/display.jsp
    /usr/local/tomcat/webapps/site2
    /usr/local/tomcat/webapps/site3
    /usr/local/tomcat/webapps/site3/test.txt

    Now I login to site1 and display.jsp gets displayed

    This page has following
    a tag ---- href="/site3/test.txt"><img src="display-test.gif" border="0">

    when I click on the image I get following error

    HTTP Status 404 - /site3/test.txt
    type Status report
    message /site3/test.txt
    description The requested resource (/site3/test.txt) is not available.


    Help needed please to solve this problem

    Thanks
    Rawar
  2. You must specify the ContextPath[ Go to top ]

    Rawar, you must specify the relative path of you resource including the context path of your application, if you don't, the web conteiner won´t found it to u.

    So u have to specify like this:

    href="<%=request.getContextPath()%>/site3/test.txt".

    I'm new to the web world too and I think this could help. If not, post reply to the topic.

    Regards, Rafael.
  3. It does not work that way either. Now I am getting following error message. Now this time it says /site1/site3/test.txt
    instead of /site3/test.txt

    HTTP Status 404 - /site1/site3/test.txt
    type Status report
    message /site1/site3/test.txt
    description The requested resource (/site1/site3/test.txt) is not available.

    I need to access the files that are located at /site3 from /site1 app.

    Need help.