【发布时间】:2012-04-18 06:31:02
【问题描述】:
我正在开发一个评论论坛,人们会在发布后发表评论并看到他们的 cmets,但我收到的是null pointer exception in servlet。
index.jsp
<form action="Comment" method="post">
<textarea style="resize: none;" cols="30" rows="3" id="myTextarea" name="myTextarea"></textarea>
</form>
评论小服务程序
try{
String comment=request.getParameter("myTextarea");
ArrayList al1=null;
ArrayList emp_list =new ArrayList();
al1.add(comment);
emp_list.add(al1);
request.setAttribute("empList",emp_list);
String nextJSP = "/result.jsp";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
dispatcher.forward(request,response);
}
catch(Exception e){
out.println("exception"+e);//exception coming
}
【问题讨论】:
标签: java jsp servlets nullpointerexception