Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
Nagaraja Chokkavarapu
JSF adding portlet war name infront of the URL
3. November 2012 11:56
Antwort

Nagaraja Chokkavarapu

Rang: New Member

Nachrichten: 5

Eintrittsdatum: 18. November 2011

Neue Beiträge

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.
 1
 2public class Alert
 3    {
 4            private String title;
 5            private String url = "/";
 6        }
 7
 8AlertBean {
 9    We are populating Alert like below and adding it to the List
10    alert.setUrl(lookupBean.getContextPath() + "/group/blah/analytics");
11}
12
13in xhtml file we are using above list as below.
14
15<h:dataTable width="100%" border="0" cellpadding="2" cellspacing="0" style="margin:10px 40px 10px 20px"
16                                rows="#{alertsBean.numberOfItemsToShow}" value="#{alertsBean.alerts}" var="alert" rowClasses="tallRow"
17                                columnClasses="col1,col2">
18<h:column>
19                                    <h:outputFormat>
20                                        <h:outputLink value="#{alert.url}" title="#{alert.tooltip}" style="#{alert.style}">
21                                            <span>#{alert.title}</span>
22                                        </h:outputLink>
23                                    </h:outputFormat>
24                                </h:column>
25
26</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
Neil Griffin
RE: JSF adding portlet war name infront of the URL
3. November 2012 11:54
Antwort

Neil Griffin

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 2179

Eintrittsdatum: 26. Juli 2005

Neue Beiträge

Please provide more information -- not sure what question you are asking. Thanks.
Nagaraja Chokkavarapu
RE: JSF adding portlet war name infront of the URL
3. November 2012 11:59
Antwort

Nagaraja Chokkavarapu

Rang: New Member

Nachrichten: 5

Eintrittsdatum: 18. November 2011

Neue Beiträge

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
Neil Griffin
RE: JSF adding portlet war name infront of the URL
3. November 2012 12:11
Antwort

Neil Griffin

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 2179

Eintrittsdatum: 26. Juli 2005

Neue Beiträge

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:

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


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

1LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
2String portalURL = liferayFacesContext.getPortalURL();
Nagaraja Chokkavarapu
RE: JSF adding portlet war name infront of the URL
3. November 2012 12:25
Antwort

Nagaraja Chokkavarapu

Rang: New Member

Nachrichten: 5

Eintrittsdatum: 18. November 2011

Neue Beiträge

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
Neil Griffin
RE: JSF adding portlet war name infront of the URL
7. November 2012 13:13
Antwort

Neil Griffin

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 2179

Eintrittsdatum: 26. Juli 2005

Neue Beiträge

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.