I have a question regarding the partial-response HTTP status code. A part of my page looks like this:
Code: Select all
<p:inputText value="#{myJsfBean.myInput01}" />
<p:commandButton value="Do Something" action="#{myJsfBean.doSomething}" partialSubmit="true" onsuccess="goToNext()" onerror="displayError()" />
Code: Select all
private String myInput01;
(getter and setter)
public void doSomething() {
if(myInput01 == "bad value") {
throw new IllegalArgumentException();
}else {
// do something
}
}
Code: Select all
public void doSomething() {
if(myInput01 == "bad value") {
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse) context.getResponse();
response.setStatus(400);
}else {
// do something
}
}
Best regards
Michael