留言板

How to get currentURL

Ed F.,修改在17 年前。

How to get currentURL

Expert 帖子: 280 加入日期: 06-6-27 最近的帖子
I have copied a lot of Liferay source code, but I can't quite find the mechanism for using the variable 'currentURL'. Sometimes it's declared and accessible for redirects, sometimes it's not. I don't ever actually see a declaration or assignment to this variable, but I've seen it used many times. I must be missing it, I am fairly blind.

Right now I'm wishing to use it but can't seem to find out what to import or how to assign the current url to it.

Does anyone happen to know?

Thanks!
-Ed
thumbnail
Joseph Shum,修改在17 年前。

RE: How to get currentURL

Expert 帖子: 336 加入日期: 06-5-17 最近的帖子
hey ed, its declared in init.jsp which is included in the jsps that use it.


String currentURL = PortletURLUtil.getCurrent(renderRequest, renderResponse).toString();



joe
Ed F.,修改在17 年前。

RE: How to get currentURL

Expert 帖子: 280 加入日期: 06-6-27 最近的帖子
Ahh thanks Joe
thumbnail
Enrique Valdes Lacasa,修改在9 年前。

RE: How to get currentURL

Junior Member 帖子: 92 加入日期: 14-7-29 最近的帖子
If you need to retrieve it in your JSP, you can easily use the themeDisplay object:

String currentURL = themeDisplay.getURLCurrent();