有点乱 看了一下
for(int i=0;i <UserName.length();i++)
{
char temp=UserName.charAt(i);
if(!((temp>='a'&&temp <='z') ¦ ¦(temp>='A'&&temp <='Z') ¦ ¦(temp=='_')))
Error+="用户名必须由数字、字母和下划线构成 <br>";
allOk=false;
}
改成
for(int i=0;i <UserName.length();i++)
{
char temp=UserName.charAt(i);
if(!((temp>='a'&&temp <='z') ¦ ¦(temp>='A'&&temp <='Z') ¦ ¦(temp=='_')))
{
Error+="用户名必须由数字、字母和下划线构成 <br>";
allOk=false;
}
}
for(int i=0;i <UserName.length();i++)
{
char temp=UserName.charAt(i);
if(!((temp>='a'&&temp <='z') ¦ ¦(temp>='A'&&temp <='Z') ¦ ¦(temp=='_')))
Error+="用户名必须由数字、字母和下划线构成 <br>";
allOk=false;
}
改成
for(int i=0;i <UserName.length();i++)
{
char temp=UserName.charAt(i);
if(!((temp>='a'&&temp <='z') ¦ ¦(temp>='A'&&temp <='Z') ¦ ¦(temp=='_')))
{
Error+="用户名必须由数字、字母和下划线构成 <br>";
allOk=false;
}
}
这句话中的或者符号有问题还有 return((str.length()>=MinLength)&&(str.length() <=MaxLength));
这句话中的MinLength和MaxLength你定义了吗?你的方法名似乎也有问题啊
An error occurred at line: 12 in the jsp file: /reg_action.jsp
Syntax error on tokens, StaticOnly expected instead
9: <body>
10:
11: <%
12: !public function LengthCheck(String str,int MinLength,int MaxLength)
13:
14: {
15: return((str.length( )>=MinLength)&&(str.length( ) <=MaxLength));
An error occurred at line: 12 in the jsp file: /reg_action.jsp
Syntax error on tokens, StaticOnly expected instead
9: <body>
10:
11: <%
12: !public function LengthCheck(String str,int MinLength,int MaxLength)
13:
14: {
15: return((str.length( )>=MinLength)&&(str.length( ) <=MaxLength));
An error occurred at line: 16 in the jsp file: /reg_action.jsp
Syntax error on token "}", delete this token
13:
14: {
15: return((str.length( )>=MinLength)&&(str.length( ) <=MaxLength));
16: }
17: %>
18: <%
19: String UserName=request.getParameter("UserName");
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
public function LengthCheck(String str,int MinLength,int MaxLength)
{
return ((str.length()>=MinLength)&&(str.length() <=MaxLength));
}
%>请LZ认真检查书写,按上面格式写好,出现异常时自己先检查下,程序员应该具备自己分析和解决问题的能力
public function LengthCheck(String str,int MinLength,int MaxLength)
{
return((str.length()>=MinLength)&&(str.length()<=MaxLength));
}
这里定义有错误??