WebSphere Portal 6.1 Portlet隐藏 和 动态Title实现

IBM Portal开发遇到两个问题, Portlet隐藏 和 动态Title处理。

Portlet隐藏: 显示一个portlet就会调用一次skin里面的control.jsp,所以想办法隐藏control.jsp的内容就可以了。可以用一个Div标签包掉整个control.jsp,需要隐藏时使用javascript隐藏整个div即可。

动态Title处理: 在Portal6.1 server中GenericPortlet.getTitle(RenderRequest request)虽然还是会被动态调用,页面title值却不更新,幸好可以通过 request.getAttribute(com.ibm.portal.portlet.Constants.DYNAMIC_TITLE)%>拿到title,同样通过js动态改变。具体请看下面代码。同时附上了Control.jsp。

Control.jsp
<%@ page session="false" buffer="none" %>
<% /* @copyright jsp */ %>
<%@ taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.0/portal-navigation" prefix="portal-navigation" %>
...

<div id="portlet.<portal-skin:portletID/>">

...

<span id="title.<portal-skin:portletID/>">
<portal-skin:portletTitle>
<portal-fmt:problem bundle="nls.problem"/>
</portal-skin:portletTitle> 
...


<!-- portlet body -->
<portal-logic:if portletState="Normal,Maximized,Minimized,Solo">
...
<script type="text/javascript">
var dynaTitle = "<%=request.getAttribute(com.ibm.portal.portlet.
Constants.DYNAMIC_TITLE)%>";
var portletElem = document.getElementById("portlet.<portal-skin:portletID/>");
var titleElem = document.getElementById("title.<portal-skin:portletID/>");

if (portletElem && titleElem)
{
if (dynaTitle == "DPAHide")
{
portletElem.style.display = 'none';
}
else if (dynaTitle != "" && dynaTitle != "null")
{
titleElem.innerHTML = dynaTitle;
}
}
</script>
...
</portal-logic:if>

</div>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值