When on JSF 2.2, you can use for this.
(paramName is the name of your query string parameter)
private String paramName; // +getter+setter
public String check() {
if (paramName == null) {
return "error.xhtml";
}
return null;
}
When not on JSF 2.2 yet (JSF 2.0/2.1), you can use for this.
private String paramName; // +getter+setter
public void check() throws IOException {
if (paramName == null) {
FacesContext.getCurrentInstance().getExternalContext().redirect("error.xhtml");
}
}
See also:
- What can , and be used for?