Fórumok

Nyitólap » Liferay Portal » English » 3. Development

Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
Alfonso Holguin
ParamUtil , getParameters and getPreferences
2012. május 29. 7:12
Válasz

Alfonso Holguin

Rangsorolás: New Member

Hozzászólások: 18

Csatlakozás dátuma: 2012. május 28.

Legújabb hozzászólások

hello,

I am new to liferay, I would like to know the difference between this three method and when there are used:

1- ParamUtil.getString(request,"name1","value1")

2- PortletPreferences prefs = renderRequest.getPreferences();
String greeting = (String)prefs.getValue("name1","value2")


3- actionRequest.getParameter("name3")

Thanks

Regards
Nagendra Kumar Busam
RE: ParamUtil , getParameters and getPreferences
2012. május 29. 7:43
Válasz

Nagendra Kumar Busam

Rangsorolás: Liferay Master

Hozzászólások: 567

Csatlakozás dátuma: 2009. július 7.

Legújabb hozzászólások

Alfonso Holguin:
hello,

I am new to liferay, I would like to know the difference between this three method and when there are used:

1- ParamUtil.getString(request,"name1","value1")

- To get name1 parameters string value if we didn't get any value it returns default value - value1
2- PortletPreferences prefs = renderRequest.getPreferences();
String greeting = (String)prefs.getValue("name1","value2")


- To get portlet preferences value stored for name1 key using EDIT mode if no value is set returns value2

3- actionRequest.getParameter("name3")

- To get value for parameter named name3 - which returns value in as Object (need to wrap it accordingly)

Thanks

Regards
Priyanka Dhingra
RE: ParamUtil , getParameters and getPreferences
2012. május 29. 7:44
Válasz

Priyanka Dhingra

Rangsorolás: Expert

Hozzászólások: 415

Csatlakozás dátuma: 2011. december 19.

Legújabb hozzászólások

Hi

PortletPreferences are used to get or set the values that will be used by the edit page (EDIT mode) to set the defaults (if needed).
actionRequest.getParameter will get the values (in String type)from the form, after submission.(You have to typeCast)
abd ParamUtil.get()you can have data with varied types after the form submission..
can check the various functions of ParamUtil here:-
http://docs.liferay.com/portal/5.1/javadocs/portal-kernel/com/liferay/portal/kernel/util/ParamUtil.html

Regards
Priyanka