How to get parameters from the URL?

来源:互联网 发布:java微服务 模块化开发 编辑:程序博客网 时间:2024/05/01 02:28
How to get parameters from the URL?
5/11/08 8:47 PM
Hi all,

Seemslike a very simple thing to do, but I've been at it for a while now andjust can't seem to get it to work! Here's my situation:

I havecreated a new page and assigned a friendlyURL to it. On that page, I'veplaced several custom portlets (Struts-based) - all of this is takingplace in it ext environment. All I would like to do is to be able toprovide a parameter in the URL and retrieve that parameter in any ofthe portlets - how do I go about doing this?

I've tried theobvious request.getParameter/request.getAttribute as well as variousmethods in the ParamUtil class, but it just doesn't seem to work. Imust be missing something obvious here - any advice would be greatlyappreciated! emoticon

Thanks!
  • ±0
  • (0 Votes)  Sign in to vote.
  • Top Top

Carlo CavallieriPosts: 20
Join Date: 3/7/08

Recent Posts Recent Posts
RE: How to get parameters from the URL?
5/12/08 2:56 AMas a reply to Phil Mironenko.
Hi Phil,

i've had the same problems and i've used the following code:

import com.liferay.portal.util.PortalUtil;

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


Note that this is a sort of hack that i've found, not an official solution.
原创粉丝点击