action="Reg"改为:
action="/Reg"

解决方案 »

  1.   

    1:<form name="register1" action="/Reg" method="post" onSubmit="return isValid(this);">2:
         <servlet>
        <servlet-name>Reg</servlet-name>
        <servlet-class>mypackage.Reg</servlet-class>//包名
      </servlet>
      <servlet-mapping>
       <servlet-name>Reg</servlet-name>  
       <url-pattern>/Reg</url-pattern>
      </servlet-mapping>
      

  2.   

    仍旧报错:HTTP Status 404 - /Reg--------------------------------------------------------------------------------type Status reportmessage /Regdescription The requested resource (/Reg) is not available.
      

  3.   

    class里 package mypackage 
    web.xml里 <servlet-class>mypackage.Reg</servlet-class>
      

  4.   

    看看你的server.xml里面的配置
    有可能是这个问题
    http://community.csdn.net/Expert/topic/3462/3462230.xml?temp=.3916284
      

  5.   

    我按上面说的改成action="./Reg"后,报错为:HTTP Status 405 - HTTP method POST is not supported by this URL--------------------------------------------------------------------------------type Status reportmessage HTTP method POST is not supported by this URLdescription The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).
      

  6.   

    HTTP method POST is not supported by this URL
    那可能是你的servlet写的有问题了,应该用doPost(),而不是用doGet(),试试看如何。
      

  7.   

    package library;
    import java.io.*; 
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import library.*;
    public class Reg extends HttpServlet{
     
     
     public void dopost(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {
        
          String username=new String(req.getParameter("username").getBytes("ISO8859_1"));
          String password= req.getParameter("password");
          String studcode=new String(req.getParameter("studcode").getBytes("ISO8859_1"));
          String email=new String(req.getParameter("email").getBytes("ISO8859_1"));
          String department=new String(req.getParameter("department").getBytes("ISO8859_1"));   String sql="insert into luer(username,password,degree,studcode,email,department)  "+
                "VALUES('"+username+"','"+password+"',0,'"+studcode+"','"+email+"','"+department+"')";
                DataConn myconn =new DataConn();//DataConn是我的另一个class,用来连接数据库的。
              
                   myconn.executeInsert(sql);
         }  
        
        
        
      
     
       
      
      public void doError(HttpServletRequest req,
                          HttpServletResponse res,
                          String str)
                          throws ServletException, IOException {
        req.setAttribute("problem", str);
        RequestDispatcher rd = getServletContext().getRequestDispatcher("/logout.jsp");
        rd.forward(req, res);
      }
                                
                               
                               
                               
    }
    这时在我的源码,请大家帮我看看哪里错了??
      

  8.   

    试试把你表单的action改为/servlet/Reg
      

  9.   

    library.Reg中,library就是我的包
    上面人家不是说的很清楚啦,把你包里面的全部package都写全了啊.比如com.xxx.xxx.
      

  10.   

    doGet(),init(),destroy()方法都没有啊?