Servlet.service() for servlet test threw exception java.lang.NullPointerException
用户名:s密码:s七月01,20073:07:27上午org.apache.catalina.core.StandardWrapperValveinvoke严重:Serv...
用户名:s密码:s
七月 01, 2007 3:07:27 上午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet test threw exception
java.lang.NullPointerException
at myfirstServle.TestRequestServlet.testParameter(TestRequestServlet.java:47)
at myfirstServle.TestRequestServlet.doGet(TestRequestServlet.java:23)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// PrintWriter out=resp.getWriter();
// out.println();
testParameter(req);
}
void testGetNeInfo(HttpServletRequest req){
System.out.println("客户的IP:"+req.getRemoteAddr());
System.out.println("contextpath:"+req.getContextPath());
System.out.println("客户端口:"+req.getRemotePort());
System.out.println("host:"+req.getRemoteHost());
System.out.println("contexttype:"+req.getContentType());
System.out.println("contextpath:"+req.getRemoteUser());
}
void testParameter(HttpServletRequest req){
String name=req.getParameter("uname");
String pwd=req.getParameter("pwd");
System.out.println("用户名:"+name+"密码:"+pwd);
String[] mobles=req.getParameterValues("moble");
for (String m:mobles) {
System.out.println(m);
}
} 展开
七月 01, 2007 3:07:27 上午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet test threw exception
java.lang.NullPointerException
at myfirstServle.TestRequestServlet.testParameter(TestRequestServlet.java:47)
at myfirstServle.TestRequestServlet.doGet(TestRequestServlet.java:23)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// PrintWriter out=resp.getWriter();
// out.println();
testParameter(req);
}
void testGetNeInfo(HttpServletRequest req){
System.out.println("客户的IP:"+req.getRemoteAddr());
System.out.println("contextpath:"+req.getContextPath());
System.out.println("客户端口:"+req.getRemotePort());
System.out.println("host:"+req.getRemoteHost());
System.out.println("contexttype:"+req.getContentType());
System.out.println("contextpath:"+req.getRemoteUser());
}
void testParameter(HttpServletRequest req){
String name=req.getParameter("uname");
String pwd=req.getParameter("pwd");
System.out.println("用户名:"+name+"密码:"+pwd);
String[] mobles=req.getParameterValues("moble");
for (String m:mobles) {
System.out.println(m);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询