Foren

Portlet's doView called twice by Liferay, why ?

thumbnail
Loic Salou, geändert vor 14 Jahren.

Portlet's doView called twice by Liferay, why ?

Junior Member Beiträge: 26 Beitrittsdatum: 06.01.09 Neueste Beiträge
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, geändert vor 14 Jahren.

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

Junior Member Beiträge: 60 Beitrittsdatum: 10.07.08 Neueste Beiträge
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, geändert vor 14 Jahren.

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

Junior Member Beiträge: 26 Beitrittsdatum: 06.01.09 Neueste Beiträge
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, geändert vor 13 Jahren.

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

New Member Beitrag: 1 Beitrittsdatum: 07.07.10 Neueste Beiträge
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, geändert vor 13 Jahren.

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

New Member Beiträge: 4 Beitrittsdatum: 18.10.10 Neueste Beiträge
Hi everybody,

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

thanks!
David Calap, geändert vor 11 Jahren.

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

New Member Beiträge: 20 Beitrittsdatum: 12.01.12 Neueste Beiträge
I have the same problem with LR 5.2.3 Any idea?