I am workin on eclipse Helios Service Release 2, serser Tomcat 7.
When i try to reach test.jst i get error 404,

type Status report

message /bandymas/view/test.jsp

description The requested resource (/bandymas/view/test.jsp) is not available.

it is strange becouse i can reach error.jsp in the same directory, using the same method.


Here is a servlet Test method doget:::

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		ServletContext context = getServletContext();
        HttpSession session = request.getSession();
        String userPath = request.getServletPath();
        String url = "";
        
        if (userPath.equals("/error")) {
        	url = "/view/error" + ".jsp";
        	System.out.println("check +" + url);
        }
        if (userPath.equals("/test")) {
            url = "/view/test" + ".jsp";
        	System.out.println("check +" + url);
            }
        try {
            request.getRequestDispatcher(url).forward(request, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        } 	
	}

Here is web.xml::::

<servlet>
    <description></description>
    <display-name>Test</display-name>
    <servlet-name>Test</servlet-name>
    <servlet-class>controller.Test</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Test</servlet-name>
    <url-pattern>/test</url-pattern>
    <url-pattern>/error</url-pattern>
  </servlet-mapping>

file hierarchy:::
-bandymas
-WebContent
-WEB-INF
-view
error.jsp
test.jsp


Does anyone have suggestion how to solve this problem??

What are the file permissions on test.jsp? If you are in linux you will want to run

chmod a+x test.jsp

.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.