1 Reply Latest reply on Mar 16, 2009 3:13 PM by jguglielmin

    Image Upload with seam

    lazygeek
      I am trying to upload Image with <s:fileUpload>, but every time i see null value in my Action.


      web.xml look like this.

           
      <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
           </filter>

           <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
           </filter-mapping>

      jspx file

      <ice:form enctype="multipart/form-data">
         <s:validateAll>
         <h:panelGrid columns="3" styleClass="viewInfo" columnClasses="leftCol, rightCol">
           <f:facet name="header">
                <h:outputText value="Product : #{product.displayName}" />
           </f:facet>
          <h:outputText value="#{msg.product_name}"/>
          <h:outputText value="#{msg.product_picture}"/>
          <s:fileUpload data="#{product.data}"/>
           <div class="buttonBox">
                <h:commandButton value="Save" action="#{productAction.save}" />
            </div>
           </s:validateAll>

      </ice:form>


      Production Action


      @Scope(ScopeType.CONVERSATION)
      @Name("productAction")
      public class ProductAction extends BaseAction<Product>
                implements
                     java.io.Serializable {

           @In(create = true)
           @Out(required = false)
           @DataModelSelection
           private Product product;

              @End
           public String save() {
                 if(product.getData != null){
                    //woo hoo, dude u got your image!!!!
                 }else{
                  //Holly shit !!! what i am doing wrong here
                 }
           }
        • 1. Re: Image Upload with seam
          jguglielmin

          Rather than maintaining 2 versions of fileupload, ICEfaces has decided to stick with the ice inputFile component (excuse me not using the correct markup, but this forum doesn't make it easy to do so).  Unless there is something specific that the s fileupload component does that can't be done with the ice component, in which case you should comment and vote on ICEfaces jira 3425.