#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    18
    Rep Power
    0

    How To Access a JSP file from other JSP


    The following is my webapplication directory structure.

    C:\Tomcat4.1\webapps\IS_Project
    -WEB-INF
    -JSP
    home.jsp,search.jsp....
    WEB-INF

    I can access the search.jsp
    http://localhost:8080/IS_Project/jsp/search.jsp like this

    My home.jsp contains simple form data , in the form action i am calling search.jsp
    I tried all these
    <form action="search.jsp">,<form action="/jsp/search.jsp">, <form action="IS_Project/jsp/search.jsp">

    For all these I am getting(depending on what I gave in the action)

    HTTP Status 404 - /IS_Project/jsp/search.jsp

    type Status report

    message /IS_Project/jsp/search.jsp

    description The requested resource (/IS_Project/jsp/search.jsp) is not available.

    Apache Tomcat/4.1.18

    I know I am missing some thing here ,please somebody help me in how to call the JSP file.Do I need to add anything in the web.xml?

    I really appreciate anykind of help.

    Archana
  2. #2
  3. No Profile Picture
    Cthulu-ish
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    Seattle
    Posts
    31
    Rep Power
    12
    try this:

    Code:
    <form action="/IS_Project/jsp/search.jsp">
    should work
  4. #3
  5. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    If you want to get the web app name without hard coding it in (in case you ever monve thi to a web app that has a different name) you can use

    Code:
    <form action="<%= request.getContextPath() %>/jsp/search.jsp">
    That way if you hav a hundred files and you change the name of the web app to IT_Project, then you don't have to touch each page.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    18
    Rep Power
    0
    Thank You , i will try those two.

    Archana

IMN logo majestic logo threadwatch logo seochat tools logo