0

i am calling a JSP from a servlet but i am getting a error Error 404- Not found.

Servlet file is reside in E:\Simple\WEB-INF\classes\servlet folder.

ServletHome.java

package servlet;  
import javax.servlet.*;    
import javax.servlet.http.*;    
import java.io.*;    
import java.net.*;    
public class ServletHome extends HttpServlet    
{    
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException    
{    
try    
{    
RequestDispatcher rd=request.getRequestDispatcher("/Vij.jsp");    
rd.forward(request,response);    
}    
   
catch(Exception e)    
{    
System.out.print(e);    
}    
}    
}

web.xml:

<web-app>    
<servlet>    
<servlet-name>ServletHome</servlet-name>    
<servlet-class>servlet.ServletHome</servlet-class>    
</servlet>    
<jsp-file>Vij.jsp</jsp-file>    
<url-pattern>*.do</url-pattern>  
<welcome-file-list>    
<welcome-file>ServletHome</welcome-file>    
</welcome-file-list>    
</web-app>

please suggest

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by rahulrinayat
0

you did compile it first?

Also, that web.xml looks a tad fishy. Are you sure you're not getting deployment errors?

0

just remove jsp-file tag,check it out correct directory structure,

<web-app>

      <servlet>

      <servlet-name>Home</servlet-name>

      <servlet-class>servlet.ServletHome</servlet-class>

      </servlet>

      
,<servlet-mapping>
<servlet-name>Home</servlet-name>
      <url-pattern>/mmm</url-pattern>
</servlet-mapping>

      <welcome-file-list>

      <welcome-file>login.jsp</welcome-file>

      </welcome-file-list>

      </web-app>

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.