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

    Image Upload with seam

    gurpreet singh Newbie
      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
                 }
           }