0
<h:form>    <p:inputText id="uname" value="#{user.name}"/>
        <p:inputText id="ac" value="#{user.account}"/>  
         <p:commandButton id="submit1" value="Submit" action="#{user.commandButtonAction}" /> ​
</h:form>

this is xhtml main code backingbean is used managedbean and viewscoped annotation

    @ManagedBean(name="user")
    @ViewScoped
    public class user {
        private String account;
        private String name;
    
        public String getName() {
            System.out.println(" name is ::"+ name);
            return name;
            
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public String getAccount()  {
            System.out.println("account no is:: "+ account);
            return account;
        }
    }
        public void setAccount(String account) {
            this.account = account;
        }
        public void commandButtonAction() throws IOException{
            System.out.println("succesful");
        }

Melloware
  • 10,435
  • 2
  • 32
  • 62
  • `@ManagedBean` is deprecated in favour of CDI - you should really be using `@Named` instead. The import statement for `@ViewScoped` also changes. What import statement are you using for `@ViewScoped`? – Brooksie Apr 23 '21 at 17:35
  • Please read https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked-or-input-value – Jasper de Vries Apr 24 '21 at 09:53

0 Answers0