登陆界面(jsp)客户端验证
来源:未知 责任编辑:责任编辑 发表时间:2015-01-01 13:16 点击:次
[html]
<pre class="html" name="code">第二步:通过servlet处理</pre><pre class="html" name="code"> </pre><pre class="html" name="code"> </pre><pre class="html" name="code">import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class validateServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//获得用户的信息
String username=req.getParameter("username");
String password=req.getParameter("password");
String repassword=req.getParameter("repassword");
String shuoming=req.getParameter("shuoming");//说明
String []sex=req.getParameterValues("sex");//获得性别
String []aihao=req.getParameterValues("aihao");//获得兴趣
String []add=req.getParameterValues("add");//获得地址
//String repassword=req.getParameter("repassword");
//String repassword=req.getParameter("repassword");
List<String> list=new ArrayList<String>();
List<String> xingqu=new ArrayList<String>();
if (null=="username"||"".equals(username))
{
list.add("there can't be a blank!");
}
if (password==null||password.length()<6||password.length()>10)
<pre class="html" name="code">第二步:通过servlet处理</pre><pre class="html" name="code"> </pre><pre class="html" name="code"> </pre><pre class="html" name="code">import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class validateServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//获得用户的信息
String username=req.getParameter("username");
String password=req.getParameter("password");
String repassword=req.getParameter("repassword");
String shuoming=req.getParameter("shuoming");//说明
String []sex=req.getParameterValues("sex");//获得性别
String []aihao=req.getParameterValues("aihao");//获得兴趣
String []add=req.getParameterValues("add");//获得地址
//String repassword=req.getParameter("repassword");
//String repassword=req.getParameter("repassword");
List<String> list=new ArrayList<String>();
List<String> xingqu=new ArrayList<String>();
if (null=="username"||"".equals(username))
{
list.add("there can't be a blank!");
}
if (password==null||password.length()<6||password.length()>10)
相关新闻>>
- 发表评论
-
- 最新评论 更多>>