1 2 Previous Next 22 Replies Latest reply on Mar 17, 2010 11:06 AM by hakanm Go to original post
      • 15. Re: rich:FileUpload @ Seam


        ive got the same problem  dataa null  at uploadlistener method.
        to solved it i just modify my web xml  following this  :


        and see rich:fileUpload with Seam

        i hope it helps.

        • 16. Re: rich:FileUpload @ Seam

          I've tried everything but item is null in sfsb


                  <filter-name>Seam Filter</filter-name>


          <rich:fileUpload id="uploadBox" addControlLabel="Add file..."  styleClass="attachDocsEnabled"
                  stopEntryControlLabel="Stop upload" uploadControlLabel="Upload file" 
                  maxFilesQuantity="1" listHeight="65" listWidth="610" immediateUpload="true">
                  <a4j:support event="onuploadcomplete" reRender="attachmentsList"/>
                   <f:facet name="label">
                           <h:outputText value="{_KB}KB from {MB}MB uploaded --- {mm}:{ss}" />


          public void listener(UploadEvent event) throws IOException {
                  UploadItem item = event.getUploadItem();
                  byte[] data = item.getData();
                  Attachment attachment = new Attachment(); // null pointer! item is null

          PL suggest!

          • 17. Re: rich:FileUpload @ Seam

            All problems with that component keeps in that code

            UploadItem item = event.getUploadItem();
            byte[] data = item.getData();

            Don't use method getData()!!! Just try get item.getFile() and than transform it to ByteArray.

            • 18. Re: rich:FileUpload @ Seam


              Let me clarify this for you,

              When the filter parameter

              createTempFiles is set to 'true' that means the component saves the file as a temporary file, so the file would be accessible through

              UploadItem.getFile() , UploadItem.isTempFile() set to true

              when the filter parameter is set to false the data would be available through UploadItem.getData().

              Do not forget that you have to set this parameter as a seam parameter which will set the Ajax4Jsf Filer when seam starts up,

              (Check this link: http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/faq/faq.html)



              • 19. Re: rich:FileUpload @ Seam

                Heyyy guys,
                I av som trouble with rich:fileUpload and seam configuration. I have tried many ways to point the debugger to the listener in action bean but i couldnt manage.
                I am using facelets 1.1.14 and richfaces 3.3.0.GA and seam 2.1.1GA.

                My codes are shown below. I need ur suggestions...


                <component class="org.jboss.seam.web.MultipartFilter">
                       <property name="createTempFiles">true</property>
                       <property name="maxRequestSize">200000</property>
                <web:multipart-filter create-temp-files="true" max-request-size="1000000" url-pattern="*.seam"/>

                     <filter-name>Seam Multipart Filter</filter-name>
                     <filter-name>Seam Multipart Filter</filter-name>

                my xhtml

                <h:form enctype="multipart/form-data">
                <rich:fileUpload fileUploadListener="#{fileUploadHome.listener}" maxFilesQuantity="1" addControlLabel="Ekle" progressLabel="yükleniyor..."
                uploadControlLabel="Yükle" clearControlLabel="Sil" stopControlLabel="Durdur" stopEntryControlLabel="İşlemi Durdur!"      clearAllControlLabel="Tümünü Sil" cancelEntryControlLabel="İşlemi İptal Et!" doneLabel="İşlem Tamamlandı." id="upload"     acceptedTypes="txt" listHeight="65" listWidth="610" >
                <a4j:support event="onupload" reRender="info" />
                <f:facet name="label">
                     <h:outputText value="{_KB}KB from {_KB}KB yüklendi --{mm}:{ss}" />

                my bean
                //No Annotation used
                public class FileUpload{
                     private Long Id;
                     private String fileName;
                     private String fileType;
                     private Integer length;
                     private byte[] data;

                my session bean
                public class FileUploadHome extends EntityHome<FileUpload> {
                     Long fileUploadId;
                     public Object getId() {
                          if (fileUploadId == null) {
                               return super.getId();
                          } else {
                               return fileUploadId;
                     private ArrayList<FileUpload> files = new ArrayList<FileUpload>();
                     private int uploadsAvailable = 5;
                     private boolean autoUpload = false;
                     private boolean useFlash = false;
                     public void listener(UploadEvent event) throws Exception {
                          UploadItem uploadItem = event.getUploadItem();
                          java.io.File file = uploadItem.getFile();
                          int extDot = uploadItem.getFileName().lastIndexOf('.');
                          String fileName = uploadItem.getFileName().substring(0, extDot);
                          FileUpload fileUpload = new FileUpload();

                • 20. Re: rich:FileUpload @ Seam

                  any suggestions?

                  • 21. Re: rich:FileUpload @ Seam

                    Hello Ismail,
                    can you clarify if you are having problems using your debbuging functions within your IDE or if the action method is not being called or if it is being called but you get an exception or a faces message?

                    • 22. Re: rich:FileUpload @ Seam

                      I have the same problem as ismail have and the action method is not called in my case. I have seam 2.2.1 and richfaces 3.x. i have a seam-gen generated project. I have been looking for a solution. some wrote that it is about multipart filter and etc .
                      any suggestions. I can send the code if needed.


                      1 2 Previous Next