please help me.

I need help from you all.

I enable to excute the servlet program . the deployment process is also correct , i am doing with the tomcat server, i had set the class path also.
the compliation of the java file is also complied,
only while excuting the program at the url path what i should be given,the exception is 404 exception, what type of exception is that .
and in the web.xml file what is the servlet name ,there is any connection to the excution with that name.
and the url name should be same name in the url path while executing.

even in the netbeans also it is not excuting.

wikipedia provide short explanation what is error 404
Can you please post your folde structure of project you talking about plus web.xml file

hope this will give the clear information , so that you can help me.

The code is not about the project , still iam in learning .

the servlet code is

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

  public class Marksservlet extends HttpServlet {
      public void dopost(HttpServletRequest req, HttpServletResponse res) throws
                               ServletException,IOException {
          int total=Integer.parseInt
              (req.getParameter("maths"))+ Integer.parseInt(req.getParameter("computers"));
          res.setContentType("text/html");
          PrintWriter pw = res.getWriter();
          pw.write("<b>Total is </b>"+total);
          float ave=total/2;
          pw.write("<b>average is </b>"+ave);
          char grade;
          if(ave>=60)
              grade='A';
          else
              grade='b';
          pw.write("<b> grade is </b>"+grade);
          pw.close();
      }
  }

the xml file is

<web-app>
 <servlet>
    <servlet-name>three</servlet-name>
  <servlet-class>Marksservlet</servlet-class>
 </servlet>
 <servlet-mapping>
<servlet-name>three</servlet-name>
  <url-pattern>/Marksservlet</url-pattern>
 </servlet-mapping>
</web-app>

and the html file is

<html>
<body>
<p align = "center">
<font size=6>
<strong>student marks</strong>
</font>
</p>
<form name=f1 method=post action="/Markssevlet">
<p>mathematics<input type =text name=maths></p>
<p align=left>computers<input type =text name=computers></p>
<p align=left><input type=submit vallue=submit>
<input type=reset value=reset></p>
</form>
</body>
</html>

here are the three programs
and we will write the code of the html also in the servlet code only

then how should we should call.
what we should write in the xml url ,
the exception is 404 exception i.e /Marksservlet is not found.

in net beans also the same promblem.
please help me

Hi,
You given

public class Marksservlet extends HttpServlet {
public void dopost(HttpServletRequest req, HttpServletResponse res) throws
ServletException,IOException {

in Servlet Class
and in Html u given

<form name=f1 method=post action="/Markssevlet">
<p>mathematics<input type =text name=maths></p>

Is it your typing mistake or Coding mistake?

hope this will give the clear information , so that you can help me.

The code is not about the project , still iam in learning .

the servlet code is

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

  public class Marksservlet extends HttpServlet {
      public void dopost(HttpServletRequest req, HttpServletResponse res) throws
                               ServletException,IOException {
          int total=Integer.parseInt
              (req.getParameter("maths"))+ Integer.parseInt(req.getParameter("computers"));
          res.setContentType("text/html");
          PrintWriter pw = res.getWriter();
          pw.write("<b>Total is </b>"+total);
          float ave=total/2;
          pw.write("<b>average is </b>"+ave);
          char grade;
          if(ave>=60)
              grade='A';
          else
              grade='b';
          pw.write("<b> grade is </b>"+grade);
          pw.close();
      }
  }

the xml file is

<web-app>
 <servlet>
    <servlet-name>three</servlet-name>
  <servlet-class>Marksservlet</servlet-class>
 </servlet>
 <servlet-mapping>
<servlet-name>three</servlet-name>
  <url-pattern>/Marksservlet</url-pattern>
 </servlet-mapping>
</web-app>

and the html file is

<html>
<body>
<p align = "center">
<font size=6>
<strong>student marks</strong>
</font>
</p>
<form name=f1 method=post action="/marks/s1">
<p>mathematics<input type =text name=maths></p>
<p align=left>computers<input type =text name=computers></p>
<p align=left><input type=submit vallue=submit>
<input type=reset value=reset></p>
</form>
</body>
</html>

here are the three programs
and we will write the code of the html also in the servlet code, how to excute that.
and int the html file we are giving the action=/marks/s1. this we should write in any of the xml file .

then how should we should call.
what we should write in the xml url ,
the exception is 404 exception i.e /Marksservlet is not found.

in net beans also the same promblem.
please help me

.

Hi,
You given

in Servlet Class
and in Html u given

Is it your typing mistake or Coding mistake?

hi, selaganapathy i.e is the typing mistake , now you can help me i think.in the xml file what is the url path we should be given.
hope any one can help me.

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.