jQuery in Action, 2nd edition*
The moose likes Other Application Frameworks and the fly likes PRG pattern with Frontman Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "PRG pattern with Frontman" Watch "PRG pattern with Frontman" New topic
Author

PRG pattern with Frontman

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
I was just reading through http://www.javaranch.com/journal/200603/Journal200603.jsp#a5 as I am looking for a way to clean up my pages.

Is the correct way to use the PRG pattern with frontman to do redirects between commands?

So for every page that has a task I would need to create 2 commands for it, one task command and one page command?

I am trying to limit the amount of scoped session variables i have but there is no other way to preserve those variables in a redirect besides setting them to the session.
so i assume every time i finish a task and need to show that data on the page in need to set it to the session in order to display it on the page after the redirect?

Is there a better way?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

John Schretz wrote:Is the correct way to use the PRG pattern with frontman to do redirects between commands?

Yes.

So for every page that has a task I would need to create 2 commands for it, one task command and one page command?

Yes. That's the pattern. That way, no page controller is mixed with task controller code.

I am trying to limit the amount of scoped session variables i have but there is no other way to preserve those variables in a redirect besides setting them to the session.
so i assume every time i finish a task and need to show that data on the page in need to set it to the session in order to display it on the page after the redirect?

Is there a better way?

I rarely carry much of anything from a task controller to a page controller. I generally fetch everything fresh in the page controller, again eliminating strong binding between the task and page controller. If the page controller expects data created in the task controller, there is strong binding between them.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Bear Bibeault wrote:
John Schretz wrote:Is the correct way to use the PRG pattern with frontman to do redirects between commands?

Yes.

So for every page that has a task I would need to create 2 commands for it, one task command and one page command?

Yes. That's the pattern. That way, no page controller is mixed with task controller code.

I am trying to limit the amount of scoped session variables i have but there is no other way to preserve those variables in a redirect besides setting them to the session.
so i assume every time i finish a task and need to show that data on the page in need to set it to the session in order to display it on the page after the redirect?

Is there a better way?

I rarely carry much of anything from a task controller to a page controller. I generally fetch everything fresh in the page controller, again eliminating strong binding between the task and page controller. If the page controller expects data created in the task controller, there is strong binding between them.


This make perfect sense, the quick DB call is prob. no performance loss. I will implement that.

Thanks

John
 
 
subject: PRG pattern with Frontman
 
Similar Threads
Post-Redirect-Get pattern with Struts 2 ModelDriven action?
Bear's Frontman, The requested resource () is not available.
Application flow
Dealing with postdata, re-submits and dupplicate entries.
page relaod probem- resending data to servlet