If you use EL 2.2, You can send parameter as an argument to a method i.e. bean.actionMethod(Type param1, Type param2).
The example is shown below.
xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>return the NOT of a boolean function</title>
</h:head>
<h:body>
<h:form>
<p:inputText value="#{inverseBean.inputVal}"
rendered="#{inverseBean.isRender(15)}"/>
<p:inputText value="#{inverseBean.inputVal}"
rendered="#{not inverseBean.isRender(15)}"/>
</h:form>
</h:body>
</html>
managedbean
/**
*
* @author Wittakarn
*/
@ManagedBean(name = "inverseBean")
@ViewScoped
public class InverseBean implements Serializable {
private String inputVal;
public String getInputVal() {
return inputVal;
}
public void setInputVal(String inputVal) {
this.inputVal = inputVal;
}
public boolean isRender(int val) {
boolean render;
if (val > 5)
render = true;
else
render = false;
inputVal = String.valueOf(val);
return render;
}
}