jsp/servlet help with Error 404

Discussions

Web tier: servlets, JSP, Web frameworks: jsp/servlet help with Error 404

  1. jsp/servlet help with Error 404 (4 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

    Threaded Messages (4)

  2. jsp/servlet help with Error 404[ Go to top ]

    try using a fully qualified url
  3. Try using the ContextPath[ Go to top ]

    If you use /site3/test.txt, the web conteiner will look for your path on the root context.

    Try using <%request.getContextPath()%>/site3/test.txt

    Regards, Rafael Naufal.
  4. Still getting Error. Need Help[ Go to top ]

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

    Now I am getting following error message.
    This time it says /site1/site3/test.txt
    instead of /site3/test.txt

    Details error is like this
    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.
  5. Try relative path[ Go to top ]

    So try using href="../site3/test.txt". Sorry, when u want to use contextPath, try ${pageContext.request.contextPath}. Try to avoid using scriptlets, use JSTL.

    Regards, Rafael Naufal.