[OmniFaces utilities] The
resolveExpressionSet()
method programmatically EL-resolve the given property on the given base object and set the given value.Method:
See also: Faces#getContext()
Usage:
Let's
suppose that we have the following simple bean:
@Named
@SessionScoped
public class
CommandBean {
private String command;
private String process;
public String getProcess() {
return
process;
}
public void setProcess(String process) {
this.process = process;
}
public String getCommand() {
return
command;
}
public void setCommand(String command) {
this.command = command;
}
}
Now, for
an instance of CommandBean, we can set the command as /f /pid 8080 and the process as taskkill via the Faces#resolveExpressionSet():
CommandBean
commandBean = new CommandBean();
Faces.resolveExpressionSet(commandBean,
"command", "/f /pid 8080");
Faces.resolveExpressionSet(commandBean,
"process", "taskkill");
We can easily
perform a check via Faces#resolveExpressionGet():
// returns /f
/pid 8080
String
command = Faces.resolveExpressionGet(commandBean, "command");
// returns taskkill
String
process = Faces.resolveExpressionGet(commandBean, "process");
Niciun comentariu :
Trimiteți un comentariu