title: Exception thrown after processing onSubmitAction
body: <p>I am very new to Spring and I have a simpleFormController with 2 methods.  referenceData() with is called when the page loads and onSubmitAction() which is called on the submit of a form.  I am getting a nullPointerExcpetion after all my onSubmitAction() code has completed and I suspect it has something to do with where the flow of control is going after the method is finished.  I want referenceData() to be called after on submitAction() so that the page behaves the same way that it does when it loads first.</p>
  
  <p>I have another requirement that may change what I think above.  I want to pass back a success or error message based on the results of the onSubmitAction().  What is the best way to do this.  Here are the relevant parts of my code:</p>
  
  <pre><code>protected Map referenceData(PortletRequest arg0, Object arg1, Errors arg2) throws Exception 
      {
          Map&lt;String, Object&gt; model = new HashMap&lt;String, Object&gt;();
  
              List&lt;Communication&gt; allCommunications = dao.getAllCommunications();
              model.put("allCommunications", allCommunications);
              model.put("error", "");   //not sure how to get this data
              model.put("success", ""); //not sure how to get this data
  
          return model;
      }
  
  protected void onSubmitAction(ActionRequest argRequest,
          ActionResponse argResponse, Object command, BindException errors)
          throws Exception
  {
      Communication form = (Communication) command;
  
          dao.updateCommunication(form);
          //I want to set a success message here that can be read in the JSP
  </code></pre>
  
  <p>
          
              
          
      </p>
  
  <pre><code>&lt;bean id="communicationsValidator" class="com.admin.portlet.communication.CommunicationsValidator"/&gt;
  
  &lt;bean id="communicationsController" class="com.admin.portlet.communication.CommunicationsAdminController"&gt;
      &lt;property name="commandName" value="communications"/&gt;
      &lt;property name="commandClass" value="com.admin.portlet.communication.vo.Communication"/&gt;
      &lt;property name="formView" value="communications/communicationsAdmin"/&gt;
      &lt;property name="successView" value="communications/communicationsAdmin"/&gt;
      &lt;property name="validator"&gt;&lt;ref bean="communicationsValidator"/&gt;&lt;/property&gt;
      &lt;property name="dao"&gt;&lt;ref bean="communicationsDao"/&gt;&lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping"&gt;
      &lt;property name="order" value="1"/&gt;
      &lt;property name="portletModeMap"&gt;
          &lt;map&gt;
              &lt;entry key="view"&gt;&lt;ref bean="communicationsController"/&gt;&lt;/entry&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Thanks in advance for any advice....</p>
  
  <p>Stack trace added</p>
  
  <pre><code>18/11/09 10:08:38:454 GMT] 0000002a ServletWrappe E   SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: /WEB-INF/jsp/communications/communicationsAdmin.jsp. Exception thrown : java.lang.NullPointerException
      at com.ibm._jsp._communicationsAdmin._jspService(_communicationsAdmin.java:212)
      at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:501)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
      at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
      at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:205)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:639)
      at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:227)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:257)
      at org.springframework.web.servlet.ViewRendererServlet.renderView(ViewRendererServlet.java:111)
      at org.springframework.web.servlet.ViewRendererServlet.processRequest(ViewRendererServlet.java:84)
      at org.springframework.web.servlet.ViewRendererServlet.doGet(ViewRendererServlet.java:65)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:501)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:639)
      at org.apache.jetspeed.dispatcher.JetspeedRequestDispatcher.include(JetspeedRequestDispatcher.java:73)
      at org.springframework.web.portlet.DispatcherPortlet.doRender(DispatcherPortlet.java:1140)
      at org.springframework.web.portlet.DispatcherPortlet.render(DispatcherPortlet.java:1094)
      at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:832)
      at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:483)
      at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:453)
      at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
      at org.apache.jetspeed.factory.JetspeedPortletInstance.render(JetspeedPortletInstance.java:103)
      at org.apache.jetspeed.container.JetspeedContainerServlet.doGet(JetspeedContainerServlet.java:277)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:501)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:639)
      at org.apache.jetspeed.container.invoker.ServletPortletInvoker.invoke(ServletPortletInvoker.java:273)
      at org.apache.jetspeed.container.invoker.ServletPortletInvoker.render(ServletPortletInvoker.java:140)
      at org.apache.pluto.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:119)
      at org.apache.jetspeed.container.JetspeedPortletContainerWrapper.renderPortlet(JetspeedPortletContainerWrapper.java:121)
      at org.apache.jetspeed.aggregator.impl.RenderingJobImpl.execute(RenderingJobImpl.java:271)
      at org.apache.jetspeed.aggregator.impl.PortletRendererImpl.renderNow(PortletRendererImpl.java:228)
      at org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(PageAggregatorImpl.java:148)
      at org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRender(PageAggregatorImpl.java:144)
      at org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.build(PageAggregatorImpl.java:78)
      at org.apache.jetspeed.aggregator.AggregatorValve.invoke(AggregatorValve.java:46)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.aggregator.HeaderAggregatorValve.invoke(HeaderAggregatorValve.java:53)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.decoration.DecorationValve.invoke(DecorationValve.java:144)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.resource.ResourceValveImpl.invoke(ResourceValveImpl.java:130)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.pipeline.valve.impl.ActionValveImpl.invoke(ActionValveImpl.java:207)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.container.ContainerValve.invoke(ContainerValve.java:109)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at com.fmr.fcpf.util.PageHistoryValve.invoke(PageHistoryValve.java:161)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.profiler.impl.ProfilerValveImpl.invoke(ProfilerValveImpl.java:248)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.security.impl.LoginValidationValveImpl.invoke(LoginValidationValveImpl.java:159)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.localization.impl.LocalizationValveImpl.invoke(LocalizationValveImpl.java:170)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.security.impl.AbstractSecurityValve$1.run(AbstractSecurityValve.java:138)
      at java.security.AccessController.doPrivileged(AccessController.java:215)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:645)
      at org.apache.jetspeed.security.JSSubject.doAsPrivileged(JSSubject.java:179)
      at org.apache.jetspeed.security.impl.AbstractSecurityValve.invoke(AbstractSecurityValve.java:132)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.container.url.impl.PortalURLValveImpl.invoke(PortalURLValveImpl.java:67)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.capabilities.impl.CapabilityValveImpl.invoke(CapabilityValveImpl.java:126)
      at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:167)
      at org.apache.jetspeed.pipeline.JetspeedPipeline.invoke(JetspeedPipeline.java:146)
      at org.apache.jetspeed.engine.JetspeedEngine.service(JetspeedEngine.java:222)
      at org.apache.jetspeed.engine.JetspeedServlet.doGet(JetspeedServlet.java:242)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:930)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
      at com.fmr.fc.common.authentication.FCLoginFilter.doFilter(FCLoginFilter.java:269)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at com.fmr.fc.common.authentication.CommonPortalFilter.doFilter(CommonPortalFilter.java:194)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:761)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:673)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:498)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
      at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3252)
      at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:264)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
      at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1439)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:112)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
      at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
  </code></pre>