• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pass Object to Page  RSS feed

 
Henry Lowell
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright all you JSF'ers. The admin piece of my current project has been switched over to JSF. Luckily, I didn't have but a couple of forms built around Struts so the move isn't too bad.

I have a page with a dataTable and I have commandLinks for the Email Address. When I click on one of these links, I am navigating to a Modify User page where I need to populate the form with the User's data.

Currently, I am value binding the User object to the session like so:



And then I have a managed-property on my Modify User bean to pull in this User object. The problem is that This Modify User page also acts as a Save New User page. So the next time the user comes to this page to add a new user, the old user is still there. Ok, I know I could pull that User object out of the session when I need to lose it, but that's too much micromanaging for a framework, I think.

So aside from something like:

application.createValueBinding("#{requestScope.currentUser}").setValue(context,user);

is there a fancy way for me to click on the email address (I already know how to get the row data) and then send that User object to the next page?

Thanks.
 
g madhava
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>> that's too much micromanaging for a framework, I think.

The framework needs to know on what data it has to work. And certainly the framework is not an work-flow based application. Even the work-flow based applications the application should be told whether to reuse the existing data or dispose of the old data to start working with the new data, and so on...

1] Do you have 2 buttons in the page, one for modifying the data and another for Saving the new user ? If yes, why not have 2 different action methods, the save method clearing of the session data.

2] You could also manage this thing in a Servlet Filter, if you know which action you are going to perform. But I would prefer approach 1] since everything will be handled at the JSF level.
 
Henry Lowell
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My problem is not what do I do once I get to the add/modify page, but transfering the object from the view page to the add/modify page. So the 2 Buttons with 2 actions point is moot.

But thanks though. I appreicate the effort.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!