1 Reply Latest reply on Aug 28, 2007 8:40 PM by shane.bryzak

    Binding not responsive using s:fileUpload

      I am trying to get <s:fileUpload to work and yet my backing bean is never being called, is there something wrong with my bindings or configuration? I am using jboss-seam-1.2.1.GA and jboss-4.0.4.GA. The log.info messages never get called but the component is rendering and acting correctly. There is no error associated with its usage in the server.log?

      web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5"
       xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      
       <!-- Ajax4jsf (must come first!) -->
       <filter>
       <display-name>Ajax4jsf Filter</display-name>
       <filter-name>ajax4jsf</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <url-pattern>*.seam</url-pattern>
       </filter-mapping>
      
       <context-param>
       <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
       <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
       </context-param>
      
       <!-- RichFaces -->
       <context-param>
       <param-name>org.ajax4jsf.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
      
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
       <!-- Seam -->
      
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <servlet>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <url-pattern>/seam/resource/*</url-pattern>
       </servlet-mapping>
      
       <filter>
       <filter-name>Seam Filter</filter-name>
       <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <filter>
       <filter-name>Seam Multipart Filter</filter-name>
       <filter-class>org.jboss.seam.web.MultipartFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Multipart Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <!-- JSF -->
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <!-- MyFaces -->
       <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
       </listener>
      
      
       <!-- JSF RI -->
       <!--
       <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
       -->
      
       <session-config>
       <session-timeout>30</session-timeout>
       </session-config>
      
      </web-app>
      
      

      uploadPDF.xhtml
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       xmlns:fn="http://java.sun.com/jsp/jstl/functions">
      <head>
      
      </head>
       <body>
       <ui:composition template="/WEB-INF/OBBRTemplate.xhtml">
       <ui:define name="body">
       <f:view>
       <script type="text/javascript">
       </script>
       <h:form id="uploadPDF"
       enctype="multipart/form-data">
       <div>
       <a4j:region>
       <a4j:outputPanel ajaxRendered="true">
       <h:messages showSummary="false"
       showDetail="true"
       style="margin: 0; padding: 0; color:red"/>
       </a4j:outputPanel>
       </a4j:region>
       <div style="border-bottom: 2px solid black; margin-top: .5em; margin-bottom: 1em;">
       <h3 style="padding-bottom: 0; margin-bottom: 0;">
       <h:outputText id="paperStudyDetails"
       value="#{msgs.uploadPDFTitle}"
       rendered="true"/>
       </h3>
       </div>
       <h:messages showSummary="false" showDetail="true" style="margin: 0; padding: 0; color:red"/>
       <!-- Paper details -->
       <table cellpadding="0"
       cellspacing="0"
       border="0"
       width="570">
       <tr>
       <td colspan="4"
       style="padding-bottom: 1em;">
       <!-- Paper title & id -->
       <table cellpadding="0"
       cellspacing="0"
       border="0">
       <tr>
       <td nowrap="nowrap"
       style="padding-top: .5em; vertical-align: top;">
       <label for="paperTitle">
       <h:outputText value="#{msgs.paperTitle}"/>
       </label>
       </td>
       <td style="padding-left: 1em; padding-top: .5em;">
       <h:outputText id="publishedPaperTitle"
       value="#{paper.title}"/>
       </td>
       </tr>
       </table>
       </td>
       </tr>
       <tr>
       <td colspan="4">
       <div style="margin-top: .5em;">
       <s:fileUpload id="upload"
       style="width: 350px;"
       accept="application/pdf"
       data="#{editunpublishedpaper.uploadedFile}"
       fileName="#{editunpublishedpaper.fileName}"/>
       </div>
       </td>
       </tr>
       <tr>
       <!-- back buttons -->
       <td style="padding-top: 1em; text-align: center;">
       <s:button view="/addEditUnpublishedPaper.xhtml"
       onclick="submit()"
       id="backBtn"
       value="#{msgs.backButton}">
       </s:button>
       </td>
       </tr>
       </table>
       </div>
       </h:form>
       </f:view>
       </ui:define>
       </ui:composition>
       </body>
      </html>
      
      
      
      
      


      EditUnpublishedPaperAction.java relevant portion
      @Stateful
      @Name("editunpublishedpaper")
      public class EditUnpublishedPaperAction
       implements EditUnpublishedPaper
      {
       @Out(scope=ScopeType.CONVERSATION,required=false)
       String fileName;
      
       @Out(scope=ScopeType.CONVERSATION,required=false)
       byte[] uploadedFile;
      
       //
       // PDF file uploaded
       @Begin(join=true)
       public void setUploadedFile(byte[] file)
       {
      log.info("$$$$$$$$$$$$$$$$$$setUploadedFile I'm here!!");
       this.uploadedFile=file;
       }
       @Begin(join=true)
       public byte[] getUploadedFile()
       {
       return this.uploadedFile;
       }
      
       //
       // Client name of PDF file uploaded
       @Begin(join=true)
       public void setFileName(String name)
       {
      log.info("$$$$$$$$$$$$$$$$$$setFileName I'm here!!");
       if (name != null && name.length() > 0) name = name.substring(name.lastIndexOf("\\")+1);
       if (name != null && name.length() > 0) this.fileName = name;
       }
      
       @Begin(join=true)
       public String getFileName()
       {
       return this.fileName;
       }