request.getParameterValues()问题

在一个JSP页面中,多个的name一样,在servlet中用Map map = new HashMap();
map.put(id, request.getParameterValues(idStr));//这里的idStr就是
// 的name
为什么
for(int i=0;i<map.size();i++){
System.out.println(map.size());
System.out.println(map.get(i).length);
/*for(int j=0;j<str.length;j++){
System.out.println(str[j]);
}*/
}
会报错?
[code="java"]2013-8-22 16:33:41 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet AddAnswerSheetServlet threw exception
java.lang.NullPointerException
at com.answerSheetServlet.AddAnswerSheetServlet.doPost(AddAnswerSheetServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.util.ChinaFilter.doFilter(ChinaFilter.java:16)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703)
at java.lang.Thread.run(Thread.java:619)[/code]

查看全部
muyexia521
木叶下521
2013/08/22 16:48
  • servlet
  • jsp
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

0个回复