This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

PRG pattern with Frontman  RSS feed

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 67261
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!