Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
Ray Augé
Getting request paremters from Services
2009. november 10. 13:47
Válasz

Ray Augé

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1206

Csatlakozás dátuma: 2005. február 7.

Legújabb hozzászólások

Hey All,

As of LPS-5826 all request parameters will be loaded into the ServiceContext attributes map.

This means that all these will be available from within services that use ServiceContext.

i.e. Want to add a form field to the User creation form?

Just add the field:

1<html type="text" name="<portlet:namespace/>myCustomField" value="..." />


Later INSIDE
 1    public User addUser(
 2            long creatorUserId, long companyId, boolean autoPassword,
 3            String password1, String password2, boolean autoScreenName,
 4            String screenName, String emailAddress, String openId,
 5            Locale locale, String firstName, String middleName, String lastName,
 6            int prefixId, int suffixId, boolean male, int birthdayMonth,
 7            int birthdayDay, int birthdayYear, String jobTitle, long[] groupIds,
 8            long[] organizationIds, long[] roleIds, long[] userGroupIds,
 9            boolean sendEmail, ServiceContext serviceContext)
10        throws PortalException, SystemException {
11                ...


Do this:

1 
2               ...
3               Serializable param = serviceContext.getAttribute("myCustomField");
4               ...


That's it!
Julio Camarero
RE: Getting request paremters from Services
2009. november 11. 0:13
Válasz

Julio Camarero

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1609

Csatlakozás dátuma: 2008. július 15.

Legújabb hozzászólások

Great idea Ray! emoticon

This is very simple and easy to use.....

We have to add a method to LocalizationUtil to get a localized field from the serviceContext (instead of the request) to allow localized fields in the forms.