Can h:inputText invoke a method inside managed bean when I press the return/enter key

前端 未结 6 1356
孤城傲影
孤城傲影 2021-02-03 14:54

So I have an inputText that has its value hook to myBean.text, I want that if I click enter/return key, the inputText will invoke a method inside

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-03 15:38

    you can probably do something like this:

    
    
    

    inside your bean:

    public void dosomething(ValueChangeEvent event)
    {
        System.out.println("I did something");
    }
    public void fakeaction(ActionEvent event)
    {
        System.out.println("I do no nothing");
    }
    

提交回复
热议问题