File Upload does not work with a4j command button. Is that a bug?
uesker Nov 23, 2010 11:50 AMHi!
In my web app, I use a data table to iterate over an arraylist. For every item i create a link to submit a file. I,m doing this with a modal panel.
So, here is a piece of xhtml page.
<ui:define name="body"> <ui:include src="/questaoPesquisa/modalDefinirArtigosControle.xhtml" /> <h:form id="fillControlForm"> <rich:panel> <f:facet name="header">#{messages['srprocess.definecontrol.page.title']}</f:facet> <h:outputText value="#{messages['srprocess.definecontrol.page.description']}"/><br/> <rich:spacer height="20px"/> <a4j:outputPanel id="tabelaQuestoesPrimarias"> <h:outputText value="#{messages['srprocess.definecontrol.page.primaryquestionstable.description']}"/> <rich:dataTable id="tablePrimaryQuestion" value="#{estudoSecundario.m_EstruturaEstudo.m_ObjetivoPesquisa.m_QuestoesPrimarias}" var="_question"> <rich:column> <f:facet name="header">#{messages['srprocess.definecontrol.page.primaryquestionstable.question']}</f:facet> #{_question.descricao} </rich:column> <rich:column> <a4j:commandLink value="#{messages['command.submitbibtex']}" action="#{defineControlAction.displayControlWindow(_question)}" oncomplete="javascript:Richfaces.showModalPanel('modalPanelArtigoControle')" reRender="definirArtigoControle:modalPanelArtigoControle"> <f:param name="taskId" value="#{taskInstance.id}"/> </a4j:commandLink> </rich:column> </rich:dataTable> </a4j:outputPanel>
And here is the modal panel page
<f:subview id="definirArtigoControle" xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <rich:modalPanel id="modalPanelArtigoControle" autosized="true"> <f:facet name="header">#{messages['srprocess.definecontrol.page.assigncontrol.title']}</f:facet> <h:form enctype="multipart/form-data"> <h:outputText value="#{messages['srprocess.definecontrol.page.assigncontrol.description']}"/><br/> <rich:spacer height="20px"/> #{defineControlAction.descQuestaoPesquisa} <rich:spacer height="20px"/> <s:decorate id="artigoControleField" template="/layout/edit.xhtml"> <ui:define name="label">#{messages['srprocess.definecontrol.page.bibtex']}</ui:define> <s:fileUpload required="true" data="#{defineControlAction.conteudoBibtex}" fileName="#{defineControlAction.fileName}" contentType="#{defineControlAction.contentType}"/> </s:decorate> <div style="clear: both" /> <div class="actionButtons"> <h:commandButton value="#{messages['command.assign']}" action="#{defineControlAction.defineControl}" onclick="javascript:Richfaces.hideModalPanel('modalPanelArtigoControle')"> <f:param name="taskId" value="#{taskInstance.id}"/> </h:commandButton> <a4j:commandButton value="#{messages['command.assign']}" action="#{defineControlAction.defineControl}" oncomplete="javascript:Richfaces.hideModalPanel('modalPanelArtigoControle')"> <f:param name="taskId" value="#{taskInstance.id}"/> </a4j:commandButton> </div> </h:form> <f:facet name="controls"> <h:graphicImage value="/img/close.png" onclick="Richfaces.hideModalPanel('modalPanelArtigoControle')" style="cursor:pointer"/> </f:facet> </rich:modalPanel> </f:subview>
When I try to use a4j:commandButton the file is not submited, but when I try with h:commandButton it works. The problem is when I use h:commandButton an exception related to JBPM it´s thrown, event with the use o f:param inside h:commandButton.
How can I use a4j:commandButton and submit a file or resolve the issue related to taskId on JBPM?
Here is the exception
Exception during request processing: Caused by javax.el.ELException with message: "java.lang.IllegalStateException: task/process id may not be null" org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339) org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348) org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58) org.jboss.el.parser.AstValue.invoke(AstValue.java:96) org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175) org.jboss.seam.navigation.Page.preRender(Page.java:311) org.jboss.seam.navigation.Pages.preRender(Pages.java:351) org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561) org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472) org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148) org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118) com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:86) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Unknown Source) Caused by java.lang.IllegalStateException with message: "task/process id may not be null"
Thanks!