java.util.NoSuchElementException问题

<body><%Stringname=request.getParameter("hidden");Enumerationen=request.getParameterN... <body>
<%
String name=request.getParameter("hidden");
Enumeration en=request.getParameterNames();
String p=(String)en.nextElement();
try{
Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e){}
Connection con=null;
try{
String uri="jdbc:mysql://localhost/new_schema";
String user="root";
String password1="123";
con=DriverManager.getConnection(uri,user,password1);
PreparedStatement pst;
String sql="";
if(p.equals("delete")){
sql="delete from table_ll where username="+name;
pst=con.prepareStatement(sql);
pst.executeUpdate();
out.println("成功删除用户!");
%>
<br><a href="manager.jsp">返回</a>
<%
}

if(p.equals("reset")){
sql="update login set password='000000' where username="+name;
pst=con.prepareStatement(sql);
pst.executeUpdate();
out.println("修改密码成功!");
%>
<br><a href="manager.jsp">返回</a>
<%
}

}
catch(Exception e){}

%>
</body>
</html>

想用上面的方法实现用户的删除和密码重置,运行的时候出现下面的错误,怎么改?
type Exception report
message An exception occurred processing JSP page /answer.jsp at line 15
description The server encountered an internal error that prevented it from fulfilling this request.
exception org.apache.jasper.JasperException: An exception occurred processing JSP page /answer.jsp at line 15

12: <%
13: String name=request.getParameter("hidden");
14: Enumeration en=request.getParameterNames();
15: String p=(String)en.nextElement();
16: try{
17: Class.forName("com.mysql.jdbc.Driver");
18: }

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

root cause java.util.NoSuchElementException
java.util.HashMap$HashIterator.nextEntry(Unknown Source)
java.util.HashMap$KeyIterator.next(Unknown Source)
java.util.Collections$2.nextElement(Unknown Source)
org.apache.jsp.answer_jsp._jspService(answer_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
展开
 我来答
才子不才0208
推荐于2018-05-06 · TA获得超过101个赞
知道答主
回答量:89
采纳率:0%
帮助的人:110万
展开全部
@GwtCompatiblepublic abstract class AbstractIterator<T> extends UnmodifiableIterator<T> {// 下面是源码 @Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }你都看到了。hasNext() 没有值呗。你看看你的集合呗。
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式