How to forward from a validate in struts
Hello guys!Writing in english because I'm from sweden.
(I bet you understand my english better then my danish)
I'm looking for a best practice for error handling during validation in Struts.
Suppose you extend ActionSupport and in the validate you perhaps doing some DB fetching and that fetching went wrong. Then I would like to forward to some general error page. But I can not find an example.
Suppose you do it like:
public void validate()
{
try
{
//Something goes very wrong
}
catch(Exception e)
{
//Then forward to a general errorpage
}
}
Since validate do not return any String (for forwarding) like execute, how do I forward the response to anything else then gong in to execute?
Or should I have a boolean "toGlobalError" member and set to true in the catch and in execute check that member first?
If you guys got any ideas please let me know!
Best regards
/Fredrik
