• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Execute backing bean method on another page?

 
Kristian Jones
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I would appreciate any suggesstions on the following scenario. I have the following.

Page 1:
Command Button

Page 2:
OutputText
OutputText2
PrePopulateFields()

When a user presses the command button on page 1 I wish to execute PrePopulateFields() and then direct the user to that page or redirect the user then call PrePopulateFields(); I'm not fussy so long as the fields displayed are updated.

Can anyone tell me whether this is possible and how to do it.

Thanks in advance
Kris.
[ June 26, 2008: Message edited by: Bear Bibeault ]
 
Joe Matthew
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the Command Button's action listener in the same Backing Bean as "PrePopulateFields" function? If so, just call the function in the command button's action listener's function. If they are in separate Backing Beans (I don't why it should be), take the instance of the BB from the faces context and execute the function.

I hope I understood the question correctly.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18108
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also am unclear.

You can have one backing bean reference another backing bean by using the faces-config file to inject the referenced bean into the referencing bean.

However, if you're expecting to click a button in one web browser window or tab and have the properties updated in another window or tab, that's not possible. JSF is using HTTP and HTTP requires that all responses come back to the same place that the request came from.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic