1 Reply Latest reply on Feb 21, 2011 11:28 PM by kragoth

    How to save 5 upoloaded images as 5 records in Database

    ananymous7239

      Click HELP for text formatting instructions. Then edit this text and check the preview.


      @Override
           @Begin(join = true)
           @End
           public String persist() {
                try {
                     BeanUtils.copyProperties(getInstance(), doImageUpload);
      
                     for (int num = 0; num < files.size(); num++) {
      
                          getInstance().setData(files.get(num).getData());
                          getInstance().setLength(files.get(num).getData().length);
                          log.info("...............files in persist"+files.get(num).getLength());
                          log.info("...............files in persist"+files.size());
                          log.info("...............files in persist"+files.get(num).getData());
      
                     }
                     super.persist();
      
                } catch (Exception e) {
                     log.info("exception" + e);
                }
                return "done";
      
           }



      i am getting image data and length in to array list:files. from files i want to save each image as one record. i am able to save only last uploaded image. can anyone has idea about this please help me


        • 1. Re: How to save 5 upoloaded images as 5 records in Database
          kragoth

          I would have answered this question for you but, you have been rude and have abused this forum.


          Posting your question on many different topics all of which did not relate at all to your question is incredibly rude not to mention frustrating for the people who want their questions answered too.


          I suggest you go read a lot of documentation about how java works. Your problem is simple and has nothing to do with Seam or anything on this forum.


          Let's see if you can see why this isn't working for you.



          This is what you are doing


          public void myStupidMethod() {
          
              int x = 10;
          
              for (int i = 0; i < 5; i++) {
                  x = x+i;
              }
          
              if (x == 10 && x == 11 && x == 12 && x == 13 && x == 14) {
                  System.out.println("If this statement prints then the universe has ended and mathematics is a joke and x holds 5 different values at the same time");
              } 
          }