Here is an example of what I am trying to do.
In the sessionScoped bean
SessionBeanloadRecord(){
Do something
ViewScopedBean viewScopedBean = (ViewScopedBean) context.getApplication().evaluateExpressionGet(context, "#{viewScopedBean}", ViewScopedBean.class);
return viewScopedBean.viewScopedBeanLoadRecord();
}
In the viewScoped bean
ViewScopedBeanloadRecord(){
Retrieve and populateFields
return "viewRecord.xhtml";
}
So in a nut shell I would like to call a method within a view scoped bean from another bean which is on another view (listRecords.xhtml). When I run this (just using a standard commandlink), the session bean works as I would expect, viewScoped bean is created and the ViewScopedBeanloadRecord method is called BUT THEN the viewScoped bean is recreated (the constructor is called again) but this time the ViewScopedBeanloadRecord is not run and the page loads with blank fields.
I understand that the view scoped bean is only alive as long as you return null (or have a void method) to stay on the same view but then how do you transition from listRecords.xhtml to viewRecord.xhtml and run the load method?
Once I am on the viewRecord.xhtml view I will also be required to load more records simultanously (in different browser windows) so I cannot keep the records in the session.
Please note: Based on company policy I am not allowed to post actual code so this example is what I am limited to. Sorry!
Any help would be appreciated!
Thanks
Eric