I config error page in web.xml as following:
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/faces/error.xhtml</location>
</error-page>
In my index.xhtml have one input field:
<h:form>
<h:inputText value="#{errorBean.text}" />
<h:commandButton value="submit" action="index.xhtml"/>
</h:form>
And my ManagedBean checked user input. If user don't type anything, bean will throw Exception as following:
@ManagedBean(name = "errorBean")
@SessionScoped
public class ErrorBean {
private String text;
private Exception e;
/**
* Creates a new instance of ErrorBean
*/
public ErrorBean() {
}
public String getText() {
return text;
}
public void setText(String text) throws Exception{
if (text.equalsIgnoreCase("")) {
throw new Exception();
} else {
this.text = text;
}
}
}
My question is: why is exception throw, url in browser is :
http://localhost:8888/ErrorNavigator/faces/index.xhtml,
I think it is:
http://localhost:8888/ErrorNavigator/faces/error.xhtml
How do I config to url in browser is:
http://localhost:8888/ErrorNavigator/faces/error.xhtml
Please help me!!!!