Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my first program on servlet and i am getting some problem.I am using tomcat 5.5 for servlet container(server), three files associated with this servlet are

home.html
HTML
<html>
<head>
 </head>
 <body>
 <form action="trialpath">
  <input type=submit values="aa" name=ab/>
   </form></body></html>


firstservlet.java
Java
import javax.servlet.*;
public class firstservlet extends GenericServlet
{
   public void service(ServletRequest req,ServletResponse)throws IOException,ServletException
   {
      res.setContentType("text/html");
      PrintWriter pw=res.getWriter();
      pw.println("this is for testing");
   }
}


web.xml file
HTML
<web-app>
<servlet>
<servlet-name>trial</servlet-name>
<servlet-class>firstservlet</servlet-class>
 </servlet>
<servlet-mapping>
<servlet-name>trial</servlet-name>
 <url-pattern>/trialpath</url-pattern>
  </servlet-mapping>
 </web-app>


now my servlet file is compiled successfully and i have pasted these three files in the this pattern of tomcat home directory

1)webapps/root/home.html
2)webapps/root/firstservlet.java
3.webapps/root/web-inf/web.xml
4)webapps/root/web-inf/classes/firstservlet.class

1

after doing these when i am try to run my servlet program using
http://localhost:8080/home.html"


i am getting a message as error page with "Not found
The requested URL /home.html was not found on this server" rather than getting the right answer.

i am trying my best not able to get the problem please help me. thanks
Posted
Updated 5-May-14 5:10am
v3
Comments
Richard MacCutchan 5-May-14 10:48am    
Look at the message; it is telling you exactly what is wrong - the URL cannot be found.
sr45687845 5-May-14 11:36am    
sir can you please tell me what should i do
Richard MacCutchan 5-May-14 12:41pm    
You should investigate why that web page cannot be found on the server, or perhaps you have not spelled it correctly.

1 solution

sir can you please tell me that what should i do
 
Share this answer
 
Comments
Richard MacCutchan 5-May-14 12:41pm    
Please do not post questions as solutions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900