0 Replies Latest reply on Dec 1, 2009 3:16 PM by Tiago Frazão

    Please - Help Me !

    Tiago Frazão Newbie

      Hi, I need a help!


      I do not know what is happening, but I created a form to submit 5 images as code below.


      <h:form id="uplForm" enctype="multipart/form-data">
        <rich:panel>
          <table>
            <tr>
              <td><s:fileUpload data="#{FileUploadService.upload1}" accept="images/*" /></td>
            </tr>
            <tr>
              <td><s:fileUpload data="#{FileUploadService.upload2}" accept="images/*" /></td>
            </tr>
            <tr>
              <td><s:fileUpload data="#{FileUploadService.upload3}" accept="images/*" /></td>
            </tr>
            <tr>
              <td><s:fileUpload data="#{FileUploadService.upload4}" accept="images/*" /></td>
            </tr>
            <tr>
              <td><s:fileUpload data="#{FileUploadService.upload5}" accept="images/*" /></td>
            </tr>
            <tr>
              <td><h:commandButton id="advertisingId" value="Upload" action="#{UploadService.nextScreen}"/></td>
            </tr>
          </table>
        </rich:panel>
      </h:form>
      



      When I upload only some images, for example, I select an image to the box 1 and one for the box 3, the box 2 is displaying the image selected in the box 1 and the box 4 and 5 are displaying the image selected in box 3, it's seems that they are using the result of the previous box, when we do not select a image for the box in question.


      I already checked the values in the Bean (get and set) and the images are being assigned correctly.


      However when I display them in the next Page as code below, it turns out what I described above.


      <table>
        <tr>
          <td>
             <s:graphicImage value="#{FileUploadService.upload1}"
                 style="border: black thin;">
                <s:transformImageSize width="125" height="100" />
             </s:graphicImage>
          </td>
        </tr>
        <tr>
          <td>
             <s:graphicImage value="#{FileUploadService.upload2}"
                 style="border: black thin;">
                <s:transformImageSize width="125" height="100" />
             </s:graphicImage>
          </td>
        </tr>
        <tr>
          <td>
             <s:graphicImage value="#{FileUploadService.upload3}"
                 style="border: black thin;">
                <s:transformImageSize width="125" height="100" />
             </s:graphicImage>
          </td>
        </tr>
        <tr>
          <td>
             <s:graphicImage value="#{FileUploadService.upload4}"
                 style="border: black thin;">
                <s:transformImageSize width="125" height="100" />
             </s:graphicImage>
          </td>
        </tr>
        <tr>
          <td>
             <s:graphicImage value="#{FileUploadService.upload5}"
                 style="border: black thin;">
                <s:transformImageSize width="125" height="100" />
             </s:graphicImage>
          </td>
        </tr>
      </table>
      



      Of course that I tried put the rendered attribute to


      <s:graphicImage
       value="#{FileUploadService.upload1}"
                 rendered="#{not empty FileUploadService.upload1}">
      



      ,but the same result.


      Below is the code of the bean, which is in conversational scope.


      @Name("FileUploadService")
      @Scope(ScopeType.CONVERSATION)
      public class FileUploadService {
      
       private byte[] upload1;
       private byte[] upload2;
       private byte[] upload3;
       private byte[] upload4;
       private byte[] upload5;
      
       public void setUpload1(byte[] bytes) throws FrameworkError {
         upload1 = bytes;
       }
      
       public void setUpload2(byte[] bytes) throws FrameworkError {
         upload2 = bytes;
       }
      
       public void setUpload3(byte[] bytes) throws FrameworkError {
         upload3 = bytes;
       }
      
       public void setUpload4(byte[] bytes) throws FrameworkError {
         upload4 = bytes;
       }
      
       public void setUpload5(byte[] bytes) throws FrameworkError {
        upload5 = bytes;
       }
      
       public byte[] getUpload1() {
        return upload1;
       }
      
       public byte[] getUpload2() {
        return upload2;
       }
      
       public byte[] getUpload3() {
        return upload3;
       }
      
       public byte[] getUpload4() {
        return upload4;
       }
      
       public byte[] getUpload5() {
        return upload5;
       }
      
      }
      



      Thank you for help