I've been playing with Seam (2.0.2.SP1) for a few weeks, and I have most of the basics nailed down, but I haven't come up with a decent solution to the following.
Suppose I have a form at /foo.xhtml
, with a rewrite rule such that URLs like /foo.seam?id=<fooId>
are converted to /foo/<fooId>
. There's a commandButton
on the form with an action of #{fooHome.update}
. I also have a navigation rule in /foo.page.xml
that redirects back to a nice, bookmark-friendly GET after a successful POST:
<navigation from-action="#{fooHome.update}">
<rule if-outcome="updated">
<redirect view-id="/foo.xhtml">
<param name="id" value="#{fooHome.instance.id}"/>
</redirect>
</rule>
</navigation>
The problem is when a validation error occurs, at which point the navigation rules get skipped, and I end up at /foo
after the POST.
My question: Is there a way to redirect on validation errors, so I end up with a GET request for /foo/<fooId>
instead of the POST to /foo
?
I tried rolling my own validation methods in fooHome
, returning a "failed" outcome, but I don't really want invalid data getting past the validation phase (and thus into the current conversation).