掲示板

JSF adding portlet war name infront of the URL

thumbnail
11年前 に Nagaraja Chokkavarapu によって更新されました。

JSF adding portlet war name infront of the URL

New Member 投稿: 5 参加年月日: 11/11/18 最新の投稿
Hi,

In portal-ext.properties we configured portal.ctx as below.
portal.ctx=/someportal

We deploy the portlets as separate war file with war file name xyz_portlets.war. In liferay-plugin-package.properties, name is "XYZ Portlets"

We have POJO class like this.

public class Alert
	{
            private String title;
            private String url = "/";
        }

AlertBean {
    We are populating Alert like below and adding it to the List
    alert.setUrl(lookupBean.getContextPath() + "/group/blah/analytics");
}

in xhtml file we are using above list as below.

<h:datatable width="100%" border="0" cellpadding="2" cellspacing="0" style="margin:10px 40px 10px 20px" rows="#{alertsBean.numberOfItemsToShow}" value="#{alertsBean.alerts}" var="alert" rowclasses="tallRow" columnclasses="col1,col2">
<h:column>
									<h:outputformat>
										<h:outputlink value="#{alert.url}" title="#{alert.tooltip}" style="#{alert.style}">
											<span>#{alert.title}</span>
										</h:outputlink>
									</h:outputformat>
								</h:column>

</h:datatable>



In the generated HTML code, link appears as http://localhost:8101/xyz_portlets/someportal/group/blah/analytics.

Looks like JSF is injecting the portlet war file name in the URL. Pl. let me know how to avoid it.

Thanks,
Nagaraja
thumbnail
11年前 に Neil Griffin によって更新されました。

RE: JSF adding portlet war name infront of the URL

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Please provide more information -- not sure what question you are asking. Thanks.
thumbnail
11年前 に Nagaraja Chokkavarapu によって更新されました。

RE: JSF adding portlet war name infront of the URL

New Member 投稿: 5 参加年月日: 11/11/18 最新の投稿
Neil,

Looks you are able to see the post before publishing. I just pressed the publish button.

Pl. let me know if you need more info.

Thanks,
Nagaraja
thumbnail
11年前 に Neil Griffin によって更新されました。

RE: JSF adding portlet war name infront of the URL

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
If you want the URL for the portal context (and not the current portlet context), then you could do something like this in your LookupBean:

FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
PortletRequest portletRequest = (PortletRequest) externalContext.getRequest();
ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
String portalURL = themeDisplay.getPortalURL();


Alternatively if you are using the liferay-faces-portal.jar dependency, you can do this:

LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
String portalURL = liferayFacesContext.getPortalURL();
thumbnail
11年前 に Nagaraja Chokkavarapu によって更新されました。

RE: JSF adding portlet war name infront of the URL

New Member 投稿: 5 参加年月日: 11/11/18 最新の投稿
Hi Neil,

Not sure I was able to explain it properly. I have issue with h:outputLink. It is adding the "portlet context url" to the value attribute. If I use following code generated HTML link is fine.

<a title="Alert" style="" href="#{alert.url}">
<span>#{alert.title}</span>
</a>

generated link: http://localhost:8101/someportal/group/blah/analytics (No Problem)

If I use

<h:outputLink value="#{alert.url}" title="#{alert.tooltip}" style="#{alert.style}">
<span>#{alert.title}</span>
</h:outputLink>

generated link is : http://localhost:8101/xyz_portlets/someportal/group/blah/analytics (Portlet context is added)

Issue is how to prevent h:outputLink adding portlet context to the URL.

Thanks,
Nagaraja
thumbnail
11年前 に Neil Griffin によって更新されました。

RE: JSF adding portlet war name infront of the URL

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
This sounds similar to a thread started by Max Maier. Please give that thread a read and let me know if you agree. At the bottom of the thread, I mention that Max was correct and directed him to read the last few comments of FACES-1331 for more info.