Render Method Called Twice

thumbnail
MANOVINAYAK AYYAPPAN, modified 12 Years ago. Regular Member Posts: 131 Join Date: 6/13/11 Recent Posts
Hi All,

I am facing this problem, for the first time.

Environment:
Liferay 6.0.6
There is only One Portlet placed in a portal page.
The portlet has a render method with one View.jsp.

The Problem:
The Render method is triggered twice when I hit the URL where the portlet is placed (say http://localhost:8080/listing).

Is this normal behaviour, or is something wrong with my implementation.

Please share your experience on this.
thumbnail
Subhasis Roy, modified 12 Years ago. Expert Posts: 275 Join Date: 1/20/12 Recent Posts
Render method should be called once only. It only gets called at the time of showing the portlet.

Can you share your code snippet
thumbnail
MANOVINAYAK AYYAPPAN, modified 12 Years ago. Regular Member Posts: 131 Join Date: 6/13/11 Recent Posts
I developed a simple portlet with a render method, with the default view.jsp. Nothing much of code involved.
Inside the render method, I had put a test Log message to be displayed.

My Observation:
After deployment of the sample portlet, I found that every time I refreshed the page on which the portlet was placed, the log message appeared twice.
The page on which the portlet was placed, had a custom theme.

When I changed the Theme from Custom to Liferay Classic, I no longer found the issue; the log message appeared only once.

So with Custom theme, the render method gets called twice whereas with standard Classic Theme, it gets called only once.

I have only some JS and CSS included in the custom theme nothing else, wondering why this is happening.
thumbnail
Tejas Kanani, modified 12 Years ago. Liferay Master Posts: 654 Join Date: 1/6/09 Recent Posts
Are you using any custom layout ?
Try by deleting the page and re-create it and add your portlet on it.
Also verify by using any OOTB layout(if you are using custom one).
thumbnail
MANOVINAYAK AYYAPPAN, modified 12 Years ago. Regular Member Posts: 131 Join Date: 6/13/11 Recent Posts
Thanks !!

This happens independent of Portal Page.

I have tried creating a new Portal Page and as well as tried applying my theme to another existing page, the result is same.

And I am using Liferay's one column layout.

I am currently debugging the theme, hope I can find the problematic area.
Avinash babu, modified 12 Years ago. New Member Posts: 2 Join Date: 6/25/13 Recent Posts
hi,
I am also facing same problem. My action mapping method is being called twice for single request. if i remove the custom theme it is working fine. how should resolve this issue. Please provide the solution if you find any.
thumbnail
MANOVINAYAK AYYAPPAN, modified 12 Years ago. Regular Member Posts: 131 Join Date: 6/13/11 Recent Posts
Sorry for not updating this.

But I figured out that it was due to my Firefox browser.

I did not find this in other browsers.

I believe some of my Add Ons were causing some problem...
Hazem Farahat, modified 12 Years ago. New Member Post: 1 Join Date: 5/13/13 Recent Posts
I am having the same problem in my portlets, and I it has this wrong behaviour on Chrome and Firefox, but works fine on IE. I need to support all browsers.

Have you reached the real cause of this problem?
tong gao, modified 12 Years ago. New Member Post: 1 Join Date: 8/3/13 Recent Posts
I have this problem too.And the doView function is same! Have the solution?
thumbnail
Pierpaolo Cira, modified 12 Years ago. Regular Member Posts: 141 Join Date: 2/26/10 Recent Posts
Same for me.... launching a single request and logging url + every originalServletRequest httpParameters (in my request method) I had:
12:08:16,780 INFO  [http-bio-9090-exec-35][RenderPortlet:42] Rendering request... www.try.it/home
12:08:16,781 INFO  [http-bio-9090-exec-35][RenderPortlet:60] -> /c/portal/layout
12:08:16,781 INFO  [http-bio-9090-exec-35][RenderPortlet:64] -> p_l_id : 10431
12:08:16,782 INFO  [http-bio-9090-exec-35][RenderPortlet:64] -> p_v_l_s_g_id : 0
12:08:22,665 WARN  [http-bio-9090-exec-35][404_jsp:109] /html/css/taglib/@theme_image_path@/common/button_bg.png
12:08:22,708 INFO  [http-bio-9090-exec-36][RenderPortlet:42] Rendering request... www.try.it/home
12:08:22,710 INFO  [http-bio-9090-exec-36][RenderPortlet:60] -> /c/portal/layout
12:08:22,710 INFO  [http-bio-9090-exec-36][RenderPortlet:64] -> p_l_id : 10431
12:08:22,711 INFO  [http-bio-9090-exec-36][RenderPortlet:64] -> p_v_l_s_g_id : 0


An interesting behaviour is that, when I load the page, it gives me the first 4 rows.... but browser (Firefox/Chrome/Safari) is waiting for graphical resources (CSS,JS etc...)... after a bit of time it starts to render the page... so it raises the warning (404.jsp) and gives me the last logs (that is a new "request" call).

Do you have any news about?

PS: I use LR6.1.1
PPS: Yes... I confirm that this issue happens only using custom themes
thumbnail
Pierpaolo Cira, modified 12 Years ago. Regular Member Posts: 141 Join Date: 2/26/10 Recent Posts
There is an opened issue, unsolved at the moment: https://issues.liferay.com/browse/LPS-40984
thumbnail
Jamie Sammons, modified 6 Years ago. Junior Member Posts: 53 Join Date: 1/18/14 Recent Posts
Hi All,

I am facing a similar issue in "liferay-dxp-7.1.10-ga1".
In my code I have overridden default render of login portlet. I also have a custom theme deployed to my site. Please see the attached code snippet for more details

​​​​​​​
Issue : Render is getting invoked multiple(3) times.(Because I see repeated entries in my tomcat console log )

Please let me know if  there is some issue with my custom module or if it is a known issue.



Thanks and Regards
Narsingh Pal
thumbnail
Wole Adetiba, modified 5 Years ago. New Member Posts: 12 Join Date: 11/9/07 Recent Posts
Hey Narsingh ,Were you able to resolve this? I am having same issue on "liferay-dxp-7.1.10-ga1"Thanks
Wole