フォーラム

ホーム » Liferay Faces » Liferay Faces - English

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Nagaraja Chokkavarapu
JSF adding portlet war name infront of the URL
2012/11/03 11:56
答え

Nagaraja Chokkavarapu

ランク: New Member

投稿: 5

参加年月日: 2011/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.
 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
2012/11/03 11:54
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 2335

参加年月日: 2005/07/26

最近の投稿

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

Nagaraja Chokkavarapu

ランク: New Member

投稿: 5

参加年月日: 2011/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
Neil Griffin
RE: JSF adding portlet war name infront of the URL
2012/11/03 12:11
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 2335

参加年月日: 2005/07/26

最近の投稿

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
2012/11/03 12:25
答え

Nagaraja Chokkavarapu

ランク: New Member

投稿: 5

参加年月日: 2011/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
Neil Griffin
RE: JSF adding portlet war name infront of the URL
2012/11/07 13:13
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 2335

参加年月日: 2005/07/26

最近の投稿

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.