Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Execute backing bean method on another page?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic