Foros de discusión

Portlet's doView called twice by Liferay, why ?

thumbnail
Loic Salou, modificado hace 15 años.

Portlet's doView called twice by Liferay, why ?

Junior Member Mensajes: 26 Fecha de incorporación: 6/01/09 Mensajes recientes
Hi all,

I'd like to understand why my portlet's doView method also called twice ?
my example:
* a simple portlet of my own, developped with icefaces 1.7.1_6 (extends ice's MainPortlet), just calling super methods (used to debug execution only).
* its content is of course icefaces JSF, and is based on 1 managed-bean (scope request).
* I have registered a Servlet Filter to catch any ajax call to the bean.

When I login I stop on my breakpoints in this order:
1. portlet constructor (only first time after deployment, later on this instance seems to be reused as it is stateless)
2. portlet's doView
3. managed bean's constructor
4. portlet's doView
5. managed bean's constructor
6. Filter's "doFilter" method.

My understanding is that for an obscure reason either the portlet container or liferay itself needs to repeat the doView; indeed, only after the second doView thus after the second time my managed bean is instanciated, only after this do I stop in my Filter, which seems to indicate that ajax procees just begins (so my browser is starting to work on this page).

What do you think ? is this normal to repeat this doView ? this duplicates my managed beans, and all ajax call which require the refresh of the pages based on this bean will be executed twice also !
Any idea ? Thanks !
Matt King, modificado hace 15 años.

RE: [Liferay Forums][3. Development] Portlet's doView called twice by Lifer

Junior Member Mensajes: 60 Fecha de incorporación: 10/07/08 Mensajes recientes
I don’t know if it’s related, but the same thing happens with any preAction classes…liferay loads them twice on page load, 3 times on the first page load after restarting tomcat
thumbnail
Loic Salou, modificado hace 15 años.

RE: [Liferay Forums][3. Development] Portlet's doView called twice by

Junior Member Mensajes: 26 Fecha de incorporación: 6/01/09 Mensajes recientes
I've just tried changing the scope of my managed-bean to session scope.
Now it seems to be instanciated just once.
OK I suppose a request bean must be instanciated each time a new request is issued, but I thought the request issuer was supposed
to be the browser, not the portal ?

I read almost everywhere the advised scope was the request scope, but now it seems to me the session scope far easier to use...
pedro lapoce, modificado hace 13 años.

RE: [Liferay Forums][3. Development] Portlet's doView called twice by

New Member Mensaje: 1 Fecha de incorporación: 7/07/10 Mensajes recientes
Has anyone found a solution for this?
It may be a portal problem with multiple request??
Now im running a portlet without any image and it still running the doview mthod twice.

in sun's forum it is refered as a bug of JSE 8...
http://192.9.162.102/thread.jspa?threadID=5061527&tstart=510

Any ideas?

Thanks in advance
thumbnail
Xavier Canal, modificado hace 13 años.

RE: [Liferay Forums][3. Development] Portlet's doView called twice by

New Member Mensajes: 4 Fecha de incorporación: 18/10/10 Mensajes recientes
Hi everybody,

Has anybody solved this problem?!
How do I change the scope as Loic said?!

thanks!
David Calap, modificado hace 11 años.

RE: [Liferay Forums][3. Development] Portlet's doView called twice by

New Member Mensajes: 20 Fecha de incorporación: 12/01/12 Mensajes recientes
I have the same problem with LR 5.2.3 Any idea?