Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Peter Hellstrand
Configuration for Spring Portlet MVC
May 6, 2012 12:34 PM
Answer

Peter Hellstrand

Rank: Regular Member

Posts: 167

Join Date: November 30, 2011

Recent Posts

I am trying to follow this guide.
http://www.liferay.com/community/wiki/-/wiki/Main/Add+Config+Page+to+Plugin+Portlet

Is it possible to accomplish this with Spring portlet MVC?
David H Nebinger
RE: Configuration for Spring Portlet MVC
May 6, 2012 1:07 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6561

Join Date: September 1, 2006

Recent Posts

Don't do it. Stick with the standard, not Liferay's legacy configuration action (which is deprecated).
Peter Hellstrand
RE: Configuration for Spring Portlet MVC
May 6, 2012 1:29 PM
Answer

Peter Hellstrand

Rank: Regular Member

Posts: 167

Join Date: November 30, 2011

Recent Posts

Thank you very much for your answer.

I have to add som properties/configuration/settings to my portlets. My portlet is instanceable. I would like to add a boolean property that the portlet should keep track of during its lifetime. What is the best way of doing this

Stick with the standard, not Liferay's legacy configuration action (which is deprecated)


Can you get me some hint where I can find more about this?

Edit: I mean what is the standard way of doing it?
Hitoshi Ozawa
RE: Configuration for Spring Portlet MVC
May 6, 2012 2:44 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Stick with the standard, not Liferay's legacy configuration action (which is deprecated).


Can you point me to where you got that information?

http://www.liferay.com/community/forums/-/message_boards/message/11818329
David H Nebinger
RE: Configuration for Spring Portlet MVC
May 6, 2012 8:23 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6561

Join Date: September 1, 2006

Recent Posts

Peter Hellstrand:
I mean what is the standard way of doing it?


Add <portlet-mode>edit</portlet-mode> to the <supports /> tag of the portlet.xml file. This is the standard way to support preferences in a portlet, and Liferay will present it w/ the 'Preferences' option of the config menu.

As far as where it was mentioned as being deprecated, Hitoshi, I can't remember where I saw that. I remember the comment from Jorge about it not getting deprecated, so maybe that isn't so. But that doesn't take away from choosing a standard way for supporting preferences vs Liferay's legacy method. The spring MVC portlet framework will probably support the standard much better than Liferay's implementation anyway...
Hitoshi Ozawa
RE: Configuration for Spring Portlet MVC
May 6, 2012 8:32 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

I think Liferay IDE was still generating template with that when configuation page option was checked.

I think Richard Sezov, Jr wrote that at Manning support site for "Liferay in Action". I think he retracted his statement.
David H Nebinger
RE: Configuration for Spring Portlet MVC
May 6, 2012 8:29 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6561

Join Date: September 1, 2006

Recent Posts

For the Liferay MVC pattern yes, but not for the others.
David H Nebinger
RE: Configuration for Spring Portlet MVC
May 6, 2012 8:35 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6561

Join Date: September 1, 2006

Recent Posts

Hitoshi Ozawa:
I think Richard Sezov, Jr wrote that at Manning support site for "Liferay in Action". I think he retracted his statement.


I knew I read it somewhere... Putting it in print, especially from someone at Liferay, will make it hard to retract... I know I like to check the errata when I'm reading a book, but certainly don't keep going back to see if there were any updates...
Hitoshi Ozawa
RE: Configuration for Spring Portlet MVC
May 6, 2012 8:38 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

I'm really amazed that Liferay.com is able to coordinate efforts this much when their employees are scattered all over the globe, but have to say that sometimes, things get through. emoticon
Peter Hellstrand
RE: Configuration for Spring Portlet MVC
May 7, 2012 8:15 AM
Answer

Peter Hellstrand

Rank: Regular Member

Posts: 167

Join Date: November 30, 2011

Recent Posts

Thank you

I have done this before and used this as a admin gui. Then I was adding entites to the db. How/where can I store portlet specific attributes. My portlet consist of two controllers, one for view and one for edit. Do I have to create an own entity and sore it with the portlet id or something similiar?
David H Nebinger
RE: Configuration for Spring Portlet MVC
May 7, 2012 10:01 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6561

Join Date: September 1, 2006

Recent Posts

They're called portlet preferences. You don't have to store them yourself, just use the portletRequest.getPreferences() method to get the PortletPreferences instance.

Use the getValue() method to retrieve, and setValue()/store() methods to save.
Peter Hellstrand
RE: Configuration for Spring Portlet MVC
May 7, 2012 11:10 AM
Answer

Peter Hellstrand

Rank: Regular Member

Posts: 167

Join Date: November 30, 2011

Recent Posts

Super!
Hitoshi Ozawa
RE: Configuration for Spring Portlet MVC
May 7, 2012 3:47 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Liferay's Developer's guide uses it PortletPreferences as the first example on how to write a portlet. If you need to set preferences by groups, you'll have to use service builder to create a portletPreference entity - I've done this in some cases based on user request.

http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/writing-the-my-greeting-portl-4