Pregunta

I have a suite of databases which when the user authenticates, a managed bean remembers the customer id. This customer id is used by all XPages across the suite of databases. All XPages have the ability to switch to a different account thus the customer id changes.

When switching account the managed bean for that databases is set, but moving to another XPage in another database and that managed bean hasn't been updated! It seems managed bean session scope is database specific, but my situation (right or wrong) means I must remember this customer id across databases.

How can this customer id set in a managed bean be remembered across databases? Do I have to result to a standard profile document as a managed bean cannot work across databases?!

¿Fue útil?

Solución 2

The only other option is when you move from one database to another, pass something in the query string that will allow you to rebuild the bean in the other database's context. If you're comfortable with Java, Per's option 2 would be the way forward.

Otros consejos

A managed bean is scoped to application, session, view or request and these scopes are only accessible within the single nsf.

You have (at least?) two options:

  1. Move all your XPages logic into one nsf that access all your different backend databases
  2. Use the server-wide server scope that is part of the XPages Starter Kit on OpenNTF

I will recommend option 1.

You have to look at it from two angles:

Source code of bean (logic):

  • bundle it to JAR and copy to to every NSF
  • use OSGi to share its logic

Data:

Value of beans are not shared: for application, view and request scope it is expected. You probably want to share session scoped bean. I am sure you can rethink and change scope of beans to other scopes, keeping session wide properties elsewhere (cookie or database). In that case, deploy your bean code server wide, as Per Henrik Lausten suggests.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top