You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Tomasz Grobel <to...@uhc.com.pl> on 2007/07/06 14:13:51 UTC

commandLink do not work properly after some time

Hello

I have problem (just like this one 
http://www.mail-archive.com/users@myfaces.apache.org/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?

Re: commandLink do not work properly after some time

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 10/07/07 10:39, Tomasz Grobel s'exprimait en ces
termes:
> Of course, there is such (high ;D ) probability, but:
> - you can of course define which beans and which methods are available
> - in my application, you have to login before you can do anything, and
> of course, if you are logged, "system knows" if you have enough rights
> to view some informations, unimportant, how you wants to get them
> - and the last one, if you are stubborn, you can do something like
> that with usual commandLink by Javascript (am I right?)
>
You can not call action on commandLink that are not 'rendered=true'
during processRequest phase, and the 'action' field of commandLink is
not exposed to client and as such can not be altered. That's one of the
reasons commandLink need an existing view to work :D
>
> David Delbecq napisał(a):
>> En l'instant précis du 10/07/07 09:48, Tomasz Grobel s'exprimait en ces
>> termes:
>>  
>>> 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.
>>>     
>> and dangerous :)
>> User could call any zero argument bean method from command line, this
>> include non authenticated users could perhaps call methods of your admin
>> beans
>>  
>>> 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/users@myfaces.apache.org/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?
>>>>>>>                         
>>
>>
>>   
>
>


Re: commandLink do not work properly after some time

Posted by Tomasz Grobel <to...@uhc.com.pl>.
Of course, there is such (high ;D ) probability, but:
- you can of course define which beans and which methods are available
- in my application, you have to login before you can do anything, and 
of course, if you are logged, "system knows" if you have enough rights 
to view some informations, unimportant, how you wants to get them
- and the last one, if you are stubborn, you can do something like that 
with usual commandLink by Javascript (am I right?)


David Delbecq napisał(a):
> En l'instant précis du 10/07/07 09:48, Tomasz Grobel s'exprimait en ces
> termes:
>   
>> 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.
>>     
> and dangerous :)
> User could call any zero argument bean method from command line, this
> include non authenticated users could perhaps call methods of your admin
> beans
>   
>> 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/users@myfaces.apache.org/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?
>>>>>>             
>>>>>>             
>
>
>   


-- 
Tomasz Grobel
Programista
Quamasoft/WebCWS.de
_____________________________
UHC sp. z o.o,
Al. Witosa 3, 20-315 Lublin, Poland
Tel. +48 81 444 20 15, w. 04
Fax. +48 81 444 20 18
Mob. +48 609 054 536
http://www.uhc.com.pl

NIP PL 712 10 76 075
Nr KRS 0000136033 SR w Lublinie XI wydział Gospodarczy KRS
Kapitał zakładowy 810.000,00 zł
Kapitał zakładowy CompuGROUP Holding AG, 
w skład którego wchodzi UHC wynosi 175.770.667 zł (€ 45.878.750)

UWAGA: Ten dokument może zawierać informacje stanowiące tajemnice
przedsiębiorstwa i przeznaczone tylko do wiadomości adresata. Zabrania
się kopiowania oraz udostępniania tego dokumentu osobom trzecim przez
osoby inne niż adresat. Jeżeli otrzymaliście Państwo ten dokument przez
pomyłkę, prosimy o jego skasowanie i powiadomienie nadawcy. Dziękujemy.

CAUTION: Privileged/confidential information may be contained in this
document and is intended only for the use of the addressee. If you are
not the addressee, you may not copy or deliver this to anyone else. If
you receive this document by mistake, please delete it and notify us
immediately. Thank you.


Re: commandLink do not work properly after some time

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 10/07/07 09:48, Tomasz Grobel s'exprimait en ces
termes:
> 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.
and dangerous :)
User could call any zero argument bean method from command line, this
include non authenticated users could perhaps call methods of your admin
beans
>
> 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/users@myfaces.apache.org/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?
>>>>>             


Re: commandLink do not work properly after some time

Posted by Tomasz Grobel <to...@uhc.com.pl>.
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/users@myfaces.apache.org/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?
>>>>     
>>>>         

Re: commandLink do not work properly after some time

Posted by David Delbecq <de...@oma.be>.
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/users@myfaces.apache.org/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?
>>>     


Re: commandLink do not work properly after some time

Posted by Tomasz Grobel <to...@uhc.com.pl>.
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/users@myfaces.apache.org/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?
>>     


Re: commandLink do not work properly after some time

Posted by David Delbecq <de...@oma.be>.
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/users@myfaces.apache.org/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?