Skip to main content

Redirect on Post with view parameters

4 replies [Last post]
laliluna
Offline
Joined: 2005-10-11
Points: 0

Hello,

I try to figure out to implement a dialog using the redirect-on-post pattern.

I want to achieve the following:
1) Link to /faces/article.xhtml?id=4711
2) Preload article from database
3) rendering the form
4) form submit, action is saving the article and leaves a "Saved message"
5) redirect to 1) and print the message

Actually only step 4 is the problem. The reason is that the form doesn't offer an attribute include-view-params. How should I solve this?

1) and 2) can easily solved with a view param and

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ed Burns

>>>>> On Thu, 22 Oct 2009 08:05:49 -0700 (PDT), webtier@javadesktop.org said:

SH> Hello,
SH> I try to figure out to implement a dialog using the redirect-on-post pattern.

SH> I want to achieve the following:
SH> 1) Link to /faces/article.xhtml?id=4711
SH> 2) Preload article from database
SH> 3) rendering the form
SH> 4) form submit, action is saving the article and leaves a "Saved message"
SH> 5) redirect to 1) and print the message

SH> Actually only step 4 is the problem. The reason is that the form doesn't offer an attribute include-view-params. How should I solve this?

SH> 1) and 2) can easily solved with a view param and SH> 3) is no prob
SH> 4) This is step, where I currently loose the view parameter
SH> 5) works with return "article?faces-redirect=true" or a navigation rule. Messages can be preserved using the flash,keepMessage method.

I'm sorry for the big delay. The combination of finishing up
Glassfishv3 and presenting at a week long conference in Brazil has
prevented me from getting to your issue any earlier.

I recommend in your action you programmatically push the message into
the flash. You don't even have to use a FacesMessage to do it, but you
certainly can. You can access the flash from the ExternalContext.

Please followup so we can continue this discussion further.

Sincerely,

Ed

--
| ed.burns@sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

laliluna
Offline
Joined: 2005-10-11
Points: 0

Hello Ed

The problem is not the message but the id. It is not included in the URL of the POST and as a consequence I cannot pass it to the redirect.

The URL series in my case is:
/faces/article.xhtml?id=4711 (GET)
/faces/article.xhtml (POST)
/faces/article.xhtml (GET after redirect with missing id)

a form/commandButton needs to be able to include view params as well.

Best Regards

Sebastian

tzwoenn
Offline
Joined: 2005-07-01
Points: 0

Which scope does your the model has to which the request parameter is bound? If it is request, then this is a valid behavior. If you need to preserve the value, you need to attach some kind of component (well, hidden one should do the work of course) to the form.

br, Sven

ccronaldo
Offline
Joined: 2010-02-28
Points: 0

I too think so

------------------------------

quang cao online | quang cao