Jsp include不调用servlet

时间:2014-02-24 09:35:40

标签: javascript jsp java-ee servlets glassfish

在我的jsp页面中,jsp:include number(1)不调用servlet ..我在cat_catalogo中有一个空指针异常。这两天我正在尝试理解这个问题。 这是我的jsp页面的结构。如果我删除jsp:include(1)和List,它可以工作,但如果我取消所有内容并只留下jsp:include(1)和List,它也可以。 我很绝望。感谢所有想要帮助我的人。

 1)<jsp:include page="CercaCategorieServlet" flush="true"/>

 <div class="contenitore">

 <div class="siderbarSx">
 ...
 while(iter.hasNext())

 <%
    List<String> cat_catalogo=(List<String>)request.getAttribute("lista_categorie");
  %>
  <form method="post" action="CercaArticoloServlet">...</form>
  //end of while
 </div>//end of sidebarSx

 <div class="contenutoprincipale">

 <jsp:include page="ContaRecensioniServlet" flush="true">
 <jsp:param name="id_articolo" value="<%=a.getId()%>" />
 </jsp:include>


 <form method="post" action="AggiungiArticoloAlCarrelloServlet">
 ...
 </form>

 //number 5 of this form
 <form method="post" action="CercaArticoloServlet">
 ...
 <a href="javascript:;" onclick="parentNode.submit();"></a>
 </form>


 </div>//end of contenutoprincipale

</div>//end of contenitore

这是玻璃鱼的结果:

Avvertenza:   Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at      org.apache.jsp.VisualizzaArticoliRicerca_jsp._jspService(VisualizzaArticoliRicerca_jsp.java    :90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at    org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875)
at     org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
at    org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:57    5)
at    org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
at  org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
at store.web.CercaArticoloServlet.doPost(CercaArticoloServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at  org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:    288)
at    org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.ja    va:206)
at  org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at  org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at   org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at   org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113     )
at  org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:11    5)
at   org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.j    ava:55)
at  org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThre    adIOStrategy.java:135)
at   org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:5    64)
at  org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)

1 个答案:

答案 0 :(得分:0)

尝试添加doPost方法..我建议您在eclipse上创建自己的网络项目。它会自动添加dogetdopost方法。 此外,您可以在为eclipse配置后运行glassfish