Hi
Thank you very much for your help.
As you suggested, I created life cycle listener, but instead of
"refresh=true" parameter I am sending "action parameter".
pages/appointments/appointments.jsf?action=appointmentsBean.showAppointments
After parsing this string, inside of listener, I am invoking:
Object o =
fc.getApplication().getVariableResolver().resolveVariable(fc, bbName);
o.getClass().getMethod(methodName).invoke(o);
Now, solution is very generic.
David Delbecq napisał(a):
Several possibilities
1) add a parameter named "refresh=true" to your link, add a life cycle
listener that, upon view creation, refresh the backing bean if it find
this parameter in request
2) do the refresh inside the backing bean, without intervention from the
view, depending on the lifetime of your datas
En l'instant précis du 09/07/07 08:24, Tomasz Grobel s'exprimait en ces
termes:
I've read your solutions and:
re 2) of course I have frames to not load menu each time
re 3) I can not redesign it (it's a long story ;) )
re 4) yes, I tried do that but as you wrote it only delays problem
I think that solution number one is the best, but I have a little
problem whit that.
I have one session backing bean. Each time I clicked menu (by
commandLink),
I run method that refreshed some backing bean content (from DB). How
can I refresh my backing bean now?
How can I run specific backing bean method using such link? Is it
possible?
Hi
commandlinks works is based on the view they are in. However, because
you use frames for navigation, it may be that the view, associated with
your commandlink, was generated, for example, 25 requests in the past,
all subsequent view request made in other frames. As a result, after
some time, when your try to call the command, JSF is unable to restore
the related view (JSF can not store an infinite number of views in user
session). The suggested workaround just resolve it by not storing view
in session, but better on client. This is not your only solution.
Possibles solutions:
1) don't use command link. Actually a commandlink is used to submit a
form, do you really want to submit a form while what you seem to look
for is just navigation? Simple <h:outputLink/> outside any form is
enough for most navigation purposes. There are even ways to pass simple
parmeters to new JSF views (eg:
http://server/app/faces/showItem.xhtml?itemId=123)
2) Have the view in the frame refresh on a regular basis, to ensure when
user use commandLinks, those comes from a still active view
3) Redesign your page, change from frames to a menu that appear on each
page, as such you are also sure action come from latest generated view
4) increase the nmber of views in session. This will delay problem but
not remove it:
<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>20</param-value>
<description>Only applicable if state saving method is
"server" (= default).
Defines the amount (default = 20) of the latest
views are stored in session.
</description>
</context-param>
En l'instant précis du 06/07/07 14:13, Tomasz Grobel s'exprimait en ces
termes:
Hello
I have problem (just like this one
http://www.mail-archive.com/[email protected]/msg04434.html)
with commandLink: I am using frames, left and right. In the left frame
I have menu (commandLinks with target to right frame). After some time
commandLinks stop invoke action on server but just reload menu. So
becouse target is set,
my left menu loads into right frame.
This situation appears only if STATE_SAVING_METHOD is set to server;
In my case, I can not use solution STATE_SAVING_METHOD set to client,
because it is very inefficient (too big post).
Maybe somebody have others ideas?