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

前端 未结 6 1352
孤城傲影
孤城傲影 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:34

    Actually you can use the following syntax:

    
      
    
    

    JSF creates an event chain and whatever you state under "onkeypress" will be evaluated BEFORE your f:ajax event. Thus you can return false to break the event chain. If you use the change event on f:ajax it'll of course fire on other change events which you probably don't want.

提交回复
热议问题