| | |
htttp status 404 error
![]() |
•
•
Join Date: Mar 2008
Posts: 8
Reputation:
Solved Threads: 1
Actually i am doing a ssc project.
The student will enter his roll no in a web page which is designed by html.
HIs marks subject wise have to be displayed wth the total marks . this will be done by using servlets
and my html code is
Ihave copied this enter codes and classed in tomcat server webapps diirectory and the directory hierarchy is
----- !WEB-INF
--------------!classes --- Ssc.class
--------------!src ----Ssc.java
------!web.xml
------!hallticket.html (web page)
------!results (access data base)
in results database i have created one table with marks
rollno telugu hindi english maths social
112 95 98 98 98 98
113 98 98 98 98 98
LIKE THAT
When i run the tomcat server it is displaying the above file that hallticket.html and web.xml
when i deploy my project , when i enter the hall ticket no
it is giving an error http status 404 error
that the source /results/marks is not found .
Please help me , where did i commit the mistake
Thank you in advance
The student will enter his roll no in a web page which is designed by html.
HIs marks subject wise have to be displayed wth the total marks . this will be done by using servlets
and my html code is
Java Syntax (Toggle Plain Text)
1, hallticket.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <BODY bgcolor=blue> <h1 align="center"><font color=red> Students Hall Ticketno</h1> <form method="post" action="http:\\localhost:8080\results\marks"> <h3 align="center">Enter Hall Ticket No</h3>   <center><input type="text" size=30><br><br> <input type="submit" value="submit"> </BODY> </HTML> 2. Ssc.java (servlet) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; public class Ssc extends HttpServlet { Connection con=null; Statement st; ResultSet rs; public void init() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:sravan","poorna","chandu"); st=con.createStatement(); } catch( Exception e) { e.printStackTrace(); } } public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException { try { String str=req.getParameter("htno"); int htno=Integer.parseInt(str); String strq="select * from marks where htno="+htno; rs=st.executeQuery(strq); PrintWriter out=res.getWriter(); if(rs.next()) { out.println("<html><body>"); out.println("<table border=1 align=center>"); out.println("<tr><th>Name</th>"); out.println("<th>Telugu</th>"); out.println("<th>Hindi</th>"); out.println("<th>English</th>"); out.println("<th>Maths</th></tr>"); out.println("<tr><td>"+rs.getString(3)+ "</td><td>"+rs.getInt(4)+ "</td><td>"+rs.getInt(5)+ "</td><td>"+rs.getInt(6)+ "</td><td>"+rs.getInt(7)); } } catch (Exception e) { e.printStackTrace(); } } } 3,web.xml <web-app> <servlet> <servlet-name>sscresults</servlet-name> <servlet-class>Ssc</servlet-class> </servlet> <servlet-mapping> <servlet-name>sscresults</servlet-name> <url-pattern>/results</url-pattern> </servlet-mapping> </web-app>
Ihave copied this enter codes and classed in tomcat server webapps diirectory and the directory hierarchy is
----- !WEB-INF
--------------!classes --- Ssc.class
--------------!src ----Ssc.java
------!web.xml
------!hallticket.html (web page)
------!results (access data base)
in results database i have created one table with marks
rollno telugu hindi english maths social
112 95 98 98 98 98
113 98 98 98 98 98
LIKE THAT
When i run the tomcat server it is displaying the above file that hallticket.html and web.xml
when i deploy my project , when i enter the hall ticket no
it is giving an error http status 404 error
that the source /results/marks is not found .
Please help me , where did i commit the mistake
Thank you in advance
Last edited by ~s.o.s~; Mar 9th, 2008 at 6:36 am. Reason: Added code tags, learn to use them.
The action attribute of your FORM tag should point to the servlet which would be doing all the processing. The servlet path can be obtained from the web.xml and is the same as the url-pattern for that servlet. In your case it should be
<form action="results"> . I don't accept change; I don't deserve to live.
![]() |
Other Threads in the Java Forum
- Previous Thread: Number Format Exception
- Next Thread: length
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application arguments array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class client code color component count database derby design eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel julia keyword linux list loop macintosh map method methods midlethttpconnection mobile netbeans newbie nullpointerexception object open-source os problem producer program programming project projectideas property read recursion reference replaysolutions ria scanner search server set size sms sort sourcelabs splash sql stop string swing testautomation threads transforms tree ui unicode validation windows






