如何从Liferay Portlet中的URL获取参数? [英] How to get parameters from URL in Liferay portlet?

查看:104
本文介绍了如何从Liferay Portlet中的URL获取参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Liferay 6中使用了像feed.jspf这样的现成Portlet的jsp:

I'm using jsp of out-of-box portlet like feed.jspf in Liferay 6:

String articleId =null;
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
articleId = httpReq.getParameter("articleId");

无论是在自定义portlet还是.jsp文件中,它都给出一个空值,但是它应该有一个值.

It is giving a null value whether in custom portlet or in .jsp files, but it should have a value.

推荐答案

当然,您始终可以使用标准的HttpServletRequest从中检索参数.您可以通过使用PortalUtil类来获得此请求,如以下示例所示:

Sure, you can always use the standard HttpServletRequest to retrieve your parameters from. You can get this request by using the PortalUtil class, like in the following example:

HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest);
String articleId = request.getParameter("articleId");

这篇关于如何从Liferay Portlet中的URL获取参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆