jspからservletに複数の隠しパラメーターを渡したい。このようにコーディングすると。エラーがスローされます
Here is the code and exception
<% ProductCategoryDAO categoryDAO=new ProductCategoryDAO();
ProductCategory category=null;
if(request.getParameter("catogoryId")!=null){
category=categoryDAO.findById(Integer.valueOf(request.getParameter("catogoryId")));
}
%>
<form action="AdminController" method="POST" name="frmaddProductCategory" >
**<input type="hidden" name="categoryAction" value="editProductCategory">**
<h1 align="center">Product Category Details</h1>
<fieldset>
<legend>Product Category</legend>
<ul>
<li>**<input type="hidden" name="categoryId" id="categoryId" readonly="readonly"
value="<%=category.getProductCategoryId() %>"/>**
</li>
<li><label for="categoryCode">Category Code</label> <input
type="text" name="categoryCode" id="categoryCode" required="required" maxlength="12" readonly="readonly"
value="<%=category.getProductCategoryCode() %>"/>
</li>
<li><label for="categoryName">Category Name</label> <input type="text"
name="categoryName" id="categoryName" required="required" autofocus="autofocus" maxlength="100"
value="<%=category.getProductCategoryName() %>"/>
</li>
<li><label for="description">Description</label> <input
type="text" name="description" id="description" maxlength="500" value="<%=category.getDescription() %>"/>
</li>
</ul>
</fieldset>
<input type="submit" name="submit" value="Update Category">
</form>
例外:
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.editProductCategory_jsp._jspService(editProductCategory_jsp.java:133)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
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)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at bnms.controllers.admin.AdminController.doGet(AdminController.java:346)
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)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Jun 22, 2013 3:40:12 PM org.apache.catalina.core.StandardWrapperValve invoke