Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Oke Enyinna
Storing an object in velocity
October 10, 2011 8:28 AM
Answer

Oke Enyinna

Rank: Junior Member

Posts: 39

Join Date: April 14, 2010

Recent Posts

Hi there,

I am trying to work with Java objects within velocity in a web content portlet template. I got some interesting tips on how to do that here.

However, I realized that when I make modifications to the objects within the velocity template, the object still retains the old values no matter how often I refresh. The changes eventually take effect after some time.

Is there a way to store the objects I work with objects in a velocity template so I can retrieve them modified after a refresh?

Thanks in advance.
Sandeep Nair
RE: Storing an object in velocity
October 10, 2011 10:14 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1705

Join Date: November 5, 2008

Recent Posts

I am not sure if it wil help, go to edit template, there should be a checkbox which say cache Enabled . Uncheck that and see if it helps

Regards,
Sandeep
Oke Enyinna
RE: Storing an object in velocity
October 11, 2011 2:28 AM
Answer

Oke Enyinna

Rank: Junior Member

Posts: 39

Join Date: April 14, 2010

Recent Posts

Thanks a lot. Very grateful for this, Sandeep.
Oke Enyinna
RE: Storing an object in velocity
October 11, 2011 4:27 AM
Answer

Oke Enyinna

Rank: Junior Member

Posts: 39

Join Date: April 14, 2010

Recent Posts

I think I was a bit hasty. This works only if there is a logged-in user. For example, I have a sample velocity tool that increments a number on the page. If there is a logged-in user, every page refresh displays an incremented number. However, when I log out, the counter re-starts from 0 and does not increment on page refresh.

How can I get an increment on page refresh even when I am not logged in?

Thanks.
Oke Enyinna
RE: Storing an object in velocity
October 11, 2011 5:01 AM
Answer

Oke Enyinna

Rank: Junior Member

Posts: 39

Join Date: April 14, 2010

Recent Posts

I got the required effect by setting layout.template.cache.enabled to false. Is there a better way?
Oke Enyinna
RE: Storing an object in velocity
October 11, 2011 5:30 AM
Answer

Oke Enyinna

Rank: Junior Member

Posts: 39

Join Date: April 14, 2010

Recent Posts

Please ignore the above. Setting layout.template.cache.enabled to false does not do the trick.