You could also do this by invoking the Faces NavigationHandler with
And additional values that were passed. I think that would be the most
stable for JSF, but if you also want it to handle servlets, then maybe what
you are suggesting is better, just skipping JSF.
On Mon, Aug 15, 2011 at 1:25 PM, Brian Leathem <bleathem(a)gmail.com> wrote:
On 11-08-12 06:50 PM, Cody Lerum wrote:
> I have a particular use case where I need to:
> 1. End the current conversation if it exists
> 2. Redirect to a specific view-id
> 3. Optionally pass along some parameters.
> This led me to create new RedirectHelper for Seam Faces that allows me
> to do something like this.
> After doing so George Gastaldi and I found that this was partially
> available in Seam Servlet through RedirectBuilder and can accomplish
> the same like this.
> redirectBuilder.redirect(request.get().getContextPath() +
> "/admin/user.xhtml").param("oid", 100).send();
> The only hang-ups being that it doesn't have support conversation
> control (yet) and also assumes that if I have a "/" at the start of my
> view-id that it is absolute and not to include the ContextPath. In
> faces however I expect that the ContextPath will be added
> ("localhost:8080/myApp/admin/home.xhtml"). IMHO RedirectBuilder just
> seems like it would be a little rougher to a new faces user too.
In addition, you don't know what the Faces Servlet mapping is, so you
could have to deal with arbitrary prefixes and extensions at the URL level.
> Does it make sense to alter the Seam Servlet RedirectBuilder to handle
> these additional functions, or should I keep RedirectHelper in Faces
> and have it be a softer way for users to work when redirecting within
> JSF? I can utilize RedirectBuilder to handle the actual redirect in
> the impl.
I'd suggest building something in Faces that builds on top of what is in
Seam Servlet. Map the viewId to the URL using the facesContext, then
delegate the rest of the url building to the Servlet RedirectBuilder.
Thanks for contributing this helper code back into the project!
seam-dev mailing list
Lincoln Baxter, III
"Keep it Simple"