Eclipse和Tomcat错误

时间:2018-06-28 14:27:21

标签: java eclipse tomcat

我在Index.html上运行服务器并尝试注册时出现此类错误: Error Eclipse

如何解决此问题?我想创建一个简单的Web应用程序,可以在其中进行注册和登录。 非常感谢 这是我的代码:

index.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form method="POST" action="CreateUser.do">
First name: <input type="text" size="40" maxlength="40" name="firstname" required="required"/><br>
Last name:  <input type="text" size="40" maxlength="40" name="lastname" required="required"/><br>
Login: <input type="text" size="40" maxlength="40" name="login" required="required">
Password:    <input type="password"  name="password" required="required" /><br> <input type="SUBMIT" value="create">  
</form> 
</body>
</html>

createuser.html

        <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New User Created</title>
</head>
<body>
    <p>
    First Name: <% String fName = request.getParameter("firstname"); out.print(fName); %>
    Last Name: <% String lName = request.getParameter("lastname"); out.print(lName); %>
    Login: <% String logI = request.getParameter("login"); out.print(logI); %>
    Password: <% String psw = request.getParameter("password"); out.print(psw); %> 
    </p>
</body>
</html>

useradd.jsp

    import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/CreateUser.do")
public class AddUser extends HttpServlet {
    private static final long serialVersionUID = 1L;
    public AddUser() {
        super();

    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        RequestDispatcher view = request.getRequestDispatcher("/WebContent/useradd.jsp");
        view.forward(request, response);    
    }
}

AddUser.java

function set_cookie() {
    if( !isset($_COOKIE['mycookie']) ){

        $value = hash( 'md5', time () . '21mondo13' );
        if ( setcookie( 'mycookie', $value, time() + 60*60*24*7 ) ) {
            $_COOKIE['mycookie'] = $value;
            echo 'cookie set';
        } else {
            echo'cookie NOT set';
        }//if
    }//if

}//set_cookie
add_action( 'init', 'set_cookie' );

0 个答案:

没有答案