Calling bean methods with arguments from JSF pages

前端 未结 3 754
长发绾君心
长发绾君心 2021-02-05 11:30

Is it possible to call bean methods & directly pass parameters to them from the view instead of requiring to first set the bean properties and then call methods without argu

3条回答
  •  被撕碎了的回忆
    2021-02-05 12:05

    You can call ManagedBean methods with arguments like this.

    
    
       
    
    

    The corresponding ManagedBean would be like this.

    @ManagedBean
    @RequestScoped
    public class StateBean
    {
        @EJB
        private RemoteInterface obj=null;
    
        public void delete(String stateID)
        {
            //Code stuff here.
        }
    }
    

    You can also directly set the value of ManagedBean properties using like this.

    
    
         
         
    
    

提交回复
热议问题