Wednesday, March 12, 2014

How to fetch parameter from url in Liferay:

Example : 1
If the value is in request object we can get the parameter like this :

String articleId1 = actionRequest.getParameter("articleId");
System.out.println("String : Article ID : "+articleId1);


Example : 2

If you are getting the value from portal url :

String articleId = ParamUtil.getString(actionRequest, "articleId");
System.out.println("Article ID : "+articleId);

Example : 3

If you are getting the parameter from address bar :

HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(actionRequest));
String myArticleId = httpReq.getParameter("articleId");

No comments:

Post a Comment