主题:麻烦大家看看在JSP中这种错误怎么处理?
<html>
<head>
<%@ page contentType="text/html; charset=gb2312" %>
<title>用户信息修改 </title>
<link rel=stylesheet href="../style.css" type="text/css">
<script language="javascript">
function isValid(form)
{
if((form.password.value.length<3)||(form.password.value.length>10))
{
alert("密码必须是3~10位字母或数字!");
return false;
}
else if((form.e_mail.value=="")||(form.e_mail.value.indexOf('@',0)==-1)||(form.e_mail.value.indexOf('.',0)
==-1)||(form.e_mail.value.length<6))
{
alert("请您输入合法的E_mail地址!");
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="UserChangeBean1" scope="page" class="firm.firm" />
<% /*第31行
String name1=(String) session.getValue("username");
String sql=" select * from user where name='"+name1+"' ";
Resultset rs=UserChangeBean1.executeQuery(sql);
String password1="";
String email1="";
String qq1="";
String domID1="";
if(rs.next())
{
password1=rs.getString("password");
email1=rs.getString("email");
qq1=rs.getString("QQ");
domID1=rs.getString("domID");
rs.close;
}
%>
<center>
<p><h4>修改会员信息 </h4>
<form method="post" action="ok_changeinfo.jsp" onsubmit="return isValid(this);">
<input type="hidden" name="user_id" value="<%=name1 %>">
<table border="1" cellspacing="0" width="332" bgcolor="#f0f8ff" bordercolorlight="#4da6ff"
bordercolordark="#ecf5ff">
<tr>
<td align='left'>用户名:<%=name1%> </td>
<td align='left'>QQ号:<input type="text" size='10' maxlength='10' name="QQ" value='<%=qq1%>'></td>
</tr>
<tr>
<td align='left'>密码:
<input type="password" size='10' maxlength='10' name="password" value='<%=password1%>'> </td>
<td align='left'>确认:<input type="password" size='10' maxlength='10' name="re_password" value='<%=password1%>'> </td>
</tr>
<tr>
<td align='left'>E_mail: <input type="text" name="e_mail" value='<%=email1%>'> </td>
<td align='left'>宿舍号:<input type="text" name="domID" value='<%=domID1%>'></td>
</tr>
<tr>
<td colspan='2' aling='center'><input type="submit" size='4' value="修改" class="buttonface"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
运行后出现如下:
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 31 in the jsp file: /changeinfo.jsp
Generated servlet error:
Syntax error, insert "AssignmentOperator ArrayInitializer" to complete Expression
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
请问大家该怎么处理?
<head>
<%@ page contentType="text/html; charset=gb2312" %>
<title>用户信息修改 </title>
<link rel=stylesheet href="../style.css" type="text/css">
<script language="javascript">
function isValid(form)
{
if((form.password.value.length<3)||(form.password.value.length>10))
{
alert("密码必须是3~10位字母或数字!");
return false;
}
else if((form.e_mail.value=="")||(form.e_mail.value.indexOf('@',0)==-1)||(form.e_mail.value.indexOf('.',0)
==-1)||(form.e_mail.value.length<6))
{
alert("请您输入合法的E_mail地址!");
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="UserChangeBean1" scope="page" class="firm.firm" />
<% /*第31行
String name1=(String) session.getValue("username");
String sql=" select * from user where name='"+name1+"' ";
Resultset rs=UserChangeBean1.executeQuery(sql);
String password1="";
String email1="";
String qq1="";
String domID1="";
if(rs.next())
{
password1=rs.getString("password");
email1=rs.getString("email");
qq1=rs.getString("QQ");
domID1=rs.getString("domID");
rs.close;
}
%>
<center>
<p><h4>修改会员信息 </h4>
<form method="post" action="ok_changeinfo.jsp" onsubmit="return isValid(this);">
<input type="hidden" name="user_id" value="<%=name1 %>">
<table border="1" cellspacing="0" width="332" bgcolor="#f0f8ff" bordercolorlight="#4da6ff"
bordercolordark="#ecf5ff">
<tr>
<td align='left'>用户名:<%=name1%> </td>
<td align='left'>QQ号:<input type="text" size='10' maxlength='10' name="QQ" value='<%=qq1%>'></td>
</tr>
<tr>
<td align='left'>密码:
<input type="password" size='10' maxlength='10' name="password" value='<%=password1%>'> </td>
<td align='left'>确认:<input type="password" size='10' maxlength='10' name="re_password" value='<%=password1%>'> </td>
</tr>
<tr>
<td align='left'>E_mail: <input type="text" name="e_mail" value='<%=email1%>'> </td>
<td align='left'>宿舍号:<input type="text" name="domID" value='<%=domID1%>'></td>
</tr>
<tr>
<td colspan='2' aling='center'><input type="submit" size='4' value="修改" class="buttonface"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
运行后出现如下:
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 31 in the jsp file: /changeinfo.jsp
Generated servlet error:
Syntax error, insert "AssignmentOperator ArrayInitializer" to complete Expression
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
请问大家该怎么处理?