4 Replies Latest reply on Nov 12, 2009 12:47 AM by Arthur Ronald F D Garcia

    request parameter and method binding

    Arthur Ronald F D Garcia Newbie

      I do not know whether it is possible but i want something like




      <f:view>
      <h:form>      
          <div>
              <label for="accountId">Type your account id</label>
              <input type="text" name="accountId"/>
          </div>
          <div>
              <label for="amount">Type amount</label>
              <input type="text" name="amount"/>
          </div>
          <div>
              <!--NOTICE IT IS #{accountService.deposit} -->
              <!--BUT I WANT TO USE #{accountService.deposit(accountId, amount)} -->
              <h:commandButton action="#{accountService.deposit}" value="Deposit amount"/>
          </div>
      </h:form>
      </f:view>
      



      And my service


      @Stateless
      @Name("accountService")
      public class AccountServiceImpl implements AccountService {
      
          @RequestParemeter
          protected Integer accountId;
      
          @RequestParemeter
          protected double amount;
      
          @PersistenceContext
          private EntityManager manager;
      
          public void deposit() {
              Account account = manager.find(Account.class, accountId);
      
              account.deposit(amount);
          }
      
      }
      



      It happens i want to use this one instead of shown above


      @Stateless
      @Name("accountService")
      public class AccountServiceImpl implements AccountService {
      
          @PersistenceContext
          private EntityManager manager;
      
          public void deposit(Integer accountId, double amount) {
              Account account = manager.find(Account.class, accountId);
      
              account.deposit(amount);
          }
      
      }
      



      Is it possible ? If so, what should i use - event or something else - to get my goal ?


      regards,