2 Replies Latest reply on Jun 17, 2009 11:48 AM by Liam Anderson

    Checkbox without being stored to database

    Liam Anderson Newbie

      Hi there,
         I am pretty new to seam and the company I work for are currently using it for a project. I was wondering if someone could give me pointers on how to solve a problem i have ran into.  This is what I am doing.


      I have a collection of basket items which I am using a data table to present. Within this there will be a checkbox for each item in the table which will indicate if it is to be refunded or not. What I am needing to find out is how do I get the values of ticked checkboxes back.  I have tried using a the same approach as the dvd store example but this didn't work (this may be because that was using stateful beans and I ain't, I don't know if i am correct or not). I am using a command button which calls a method in my action called refundItems.


      Thanks

        • 2. Re: Checkbox without being stored to database
          Liam Anderson Newbie
          Hey Thanks for your reply, heres the code for what I have. IN the action I am only echoing out at the moment until I have the info i need.

          Seam Page Code:-
          <h:selectBooleanCheckbox value="#{customerorderHome.refund[_basketitem]}" id="refundCheckbox" />

          Action Code:-
          private Map<BasketItem,Boolean> refund = new HashMap<BasketItem,Boolean>();

          public Map getRefund()
          {
                  return this.refund;
          }

          public void releaseAllSeats()
          {
                  for(Map.Entry<BasketItem,Boolean> item : this.refund.entrySet())
                  {
                          System.out.println("Test" + item.getKey().getId());
                  }
                 
                  this.refund = new HashMap<BasketItem,Boolean>();
          }

          Thanks