package login.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import sun.security.provider.certpath.OCSPResponse.ResponseStatus;
/**
* Servlet implementation class PageServlet
*/
@WebServlet("/PageServlet")
public class PageServlet extends HttpServlet {
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// 获取相应编码格式
resp.setContentType("text/html;charset=utf-8");
// 相应处理结果
resp.getWriter().write("<html>");
resp.getWriter().write("<head>");
resp.getWriter().write("</head>");
resp.getWriter().write("<body>");
resp.getWriter().write("<form action='login' method='get'>");
resp.getWriter().write("</form>");
resp.getWriter().write("用户名:<input type='text' name='uname' value=''/><br/>");
resp.getWriter().write("密码:<input type='password' name='pwd' value=''/><br/>");
resp.getWriter().write("<input type='submit' value='登陆'/><br/>");
resp.getWriter().write("</body>");
resp.getWriter().write("</html>");
}
}
这段代码怎么运行不了啊,跟着网课老师的写的,不过他用的myeclipse,我用的eclipse,不知道问题出在那里了,请指教,谢谢!