在jsp中,总是报"
Syntax error on token ",", ; expected"错误.
页面功能:对用户填写的注册信息进行服务器验证.
源代码:
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.*,java.util.* "
errorPage= " " %>
<!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=gb2312 ">
<title> 注册判断 </title>
</head>
<body>
<%
public LengthCheck(String str,int MinLength,int MaxLength)---报错行
{
return((str.length> =MinLength)&&(str.length <=MaxLength));
}
String UserName=request.getParameter( "UserName ");
String NickName=request.getParameter( "NickName ");
String Sex=request.getParameter( "Sex ");
String Password=request.getParameter( "Password ");
String PwdConfirm=request.getParameter( "PwdConfirm ");
String Question=request.getParameter( "Question ");
String Answer=request.getParameter( "Answer ");
String Email=request.getParameter( "Email ");
String Error=new String();
%>
<%
boolean allOk=true;
String Number= "0123456789 ";
for(int i=0;i <UserName.length();i++)
{
char temp=UserName.charAt(i);
if(!((temp> = 'a '&&temp <= 'z ')||(temp> = 'A '&&temp <= 'Z ')||(temp== '_ ')||(temp.indexOf(temp)!=-1)))
Error+= "用户名必须由数字、字母和下划线构成 <br> ";
allOk=false;
}
if(!LengthCheck(UserName,4,20))
{
Error+= "请检查用户名长度 <br> ";
allOk=false;
}
if(NickName.length()==0)
{
Error+= "请填写昵称 <br> ";
NickName= " ";
allOk=false;
}
if(Sex.equals( "男 &