1) check input data, between 0 - 100
<h:inputText value="#{numberBean.userNumber}" required="true">
<f:validateLongRange minimum="0" maximum="100"/>
</h:inputText>
2) what is differences between action and actionlistener
Basically the "action" attribute refers to an action method which returns a String from which the Faces navigation model can use to decide whether or not a navigation is necessary based on the value of the string.
typically one uses an action method to execute some code after a button or link is clicked and then possibly navigate based on the outcome of executed code.
An actionlistener method compared to an action method does not return a String. Instead it returns void. It is basically identical to the action method but instead it just executes the code after an action event (button click or link click) but a navigation is not needed.
A good example of actionlistener could be in response to clicking on a checkbox and having the actionlistener code behind it change a visual attribute of a page such as render a component that was not rendered before..
Chapter 8 has exactly this example where I show how you can have a checkbox when clicked render an additional field in an input form.
-Chris
http://www.coderanch.com/t/212114/JSF/java/what-differences-between-action-actionlistener
<h:inputText value="#{numberBean.userNumber}" required="true">
<f:validateLongRange minimum="0" maximum="100"/>
</h:inputText>
2) what is differences between action and actionlistener
Basically the "action" attribute refers to an action method which returns a String from which the Faces navigation model can use to decide whether or not a navigation is necessary based on the value of the string.
typically one uses an action method to execute some code after a button or link is clicked and then possibly navigate based on the outcome of executed code.
An actionlistener method compared to an action method does not return a String. Instead it returns void. It is basically identical to the action method but instead it just executes the code after an action event (button click or link click) but a navigation is not needed.
A good example of actionlistener could be in response to clicking on a checkbox and having the actionlistener code behind it change a visual attribute of a page such as render a component that was not rendered before..
Chapter 8 has exactly this example where I show how you can have a checkbox when clicked render an additional field in an input form.
-Chris
http://www.coderanch.com/t/212114/JSF/java/what-differences-between-action-actionlistener
JSF中Action与ActionListener的区别
本文详细解释了JSF框架中Action与ActionListener之间的区别。Action通常用于执行一些代码并在按钮或链接点击后返回字符串,以决定是否进行页面导航。而ActionListener则在按钮点击或链接点击后仅执行代码而不进行导航。

被折叠的 条评论
为什么被折叠?



