日期:2014-05-17 浏览次数:20777 次
LoginServlet.java /** * */ package sources; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author liusk * */ public class LoginServlet extends HttpServlet{ /** * */ private static final long serialVersionUID = 5242137913016751300L; public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("Windows-31J"); String userid = request.getParameter("userId"); response.setContentType("text/html; charset=Windows-31J"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<body>"); if (userid==null || "".equals(userid)) { out.println("The user's name is null!!!"); } else { out.println("<h1>welcome " + userid + "</h1>"); } out.println("</body>"); out.println("</html>"); out.close(); } }
------解决方案--------------------
jquery插件验证吧。。骚年
------解决方案--------------------
顶1楼,话说一楼是大神级的人物,有什么问题找他总没错
------解决方案--------------------
在页面写个message用来显示那红色的字就可以啊!
------解决方案--------------------
Ajax