2011-11-18 126 views
1

我试图在IBM WebSphere Portal 6.1中部署一个portlet,该portlet具有一个MultiBox(一个Lightbox的扩展版本,它不仅允许显示图片,还有其他类型的组件,在我的情况下是一个HTML反馈表单)。在IBM WebSphere Portal 6.1 Portlet上使用Multibox(mootools)

我使用MultiBox的 - 对MooTools的1.2,为特色在http://www.liamsmart.co.uk/Downloads/multiBox/

当我下载的zip文件解压缩到我的机器,它工作得很好,因为它是纯HTML;但是当我将所有文件包含在Portlet项目中时(我使用RAD 8.0创建符合JSR-286的基本Portlet,使用Java 1.5和运行时作为WebSphere Portal 7.0存根,所有这些都遵循New Portlet Project向导)

本周我一直在搜索关于这种部署的信息,但我还没有找到任何东西。有谁知道我在哪里可以找到我需要的帮助?

在此先感谢。

+0

您确定此应用程序与portlet兼容吗? –

+0

@ udo-held根据我的一位工作伙伴告诉我的说法,它似乎是portlet兼容的,我公司的某个人使用multibox和IBM WebSphere Portal portlet进行了一些开发。我正在尝试联系该人以获取我需要的所有信息;当我得到它时,我会与Stack Overflow社区分享它。谢谢。 –

回答

0

好的,我终于能够问过曾经从事这种事情的人,他给了我一些指导方针,以便完成我的发展。

是我最后做的是以下几点:

首先,我做这在portlet的doView方法(在这个例子中,/Feedback/src/com/ibm/feedback/FeedbackPortlet.java):

public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { 
    response.setContentType(request.getResponseContentType()); 

    String targetJsp = "/_Feedback/jsp/html/FeedbackPortletView.jsp"; 
    String nextTask = request.getParameter("nextTask"); 
    if ("verFormulario".equalsIgnoreCase(nextTask)) { 
     targetJsp = "/_Feedback/multibox/files/feedbackform.jsp"; 
    } 

    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(targetJsp); 
    rd.include(request, response); 
} 

然后,在JSP为portlet视图(在本例/Feedback/WebContent/_Feedback/jsp/html/FeedbackPortletView.jsp),去执行以下操作:

<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1" import="java.util.*,javax.portlet.*,com.ibm.feedback.*"%> 
<%@page import="com.ibm.wps.l2.urlspihelper.portletrequest.PortletURLHelper"%> 
<%@page import="javax.portlet.PortletURL"%> 
<%@page import="javax.servlet.jsp.jstl.core.LoopTagStatus"%> 
<%@page import="java.util.HashMap"%> 
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> 
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" prefix="portlet-client-model"%> 

<portlet:defineObjects/> 
<portlet-client-model:init> 
    <portlet-client-model:require module="ibm.portal.xml.*"/> 
    <portlet-client-model:require module="ibm.portal.portlet.*"/> 
</portlet-client-model:init> 
<head> 

<% 
    PortletURL url = renderResponse.createRenderURL(); 
    url.setParameter("keepSession", "true"); 
    url.setParameter("saveMap", "true"); 

    StringBuffer sb = new StringBuffer(); 

    HashMap params = new HashMap(); 
    params.put("nextTask", new String[] { "verFormulario" }); 
%> 

<!-- Copy code below --> 
<link type="text/css" rel="stylesheet" href="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/css/multibox.css"/> 

<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/mootools-1.2.4-core-yc.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/mootools-1.2.4.4-more-yc.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/overlay.js"></script> 
<script type="text/javascript" src="<%=renderResponse.encodeURL(renderRequest.getContextPath())%>/_Feedback/multibox/js/multibox.js"></script> 
<script type="text/javascript"> 
    window.addEvent('domready', function(){ 
     //call multiBox 
     var initMultiBox = new multiBox({ 
      mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files) 
      container: $(document.body),//where to inject multiBox 
      descClassName: 'multiBoxDesc',//the class name of the description divs 
      path: './_Feedback/multibox/files/',//path to mp3 and flv players 
      useOverlay: true,//use a semi-transparent background. default: false; 
      maxSize: {w:600, h:400},//max dimensions (width,height) - set to null to disable resizing 
      addDownload: false,//do you want the files to be downloadable? 
      pathToDownloadScript: './_Feedback/multibox/js/forceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included) 
      addRollover: true,//add rollover fade to each multibox link 
      addOverlayIcon: true,//adds overlay icons to images within multibox links 
      addChain: true,//cycle through all images fading them out then in 
      recalcTop: true,//subtract the height of controls panel from top position 
      addTips: true,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips) 
      autoOpen: 0//to auto open a multiBox element on page load change to (1, 2, or 3 etc) 
     }); 
    }); 
</script> 
<!-- Copy code above --> 

<!-- Styles --> 
<style type="text/css"> 
    body{ 
     font-family:Arial; 
    } 
</style> 
<!-- Styles --> 
</head> 
<body style="width:800px; margin:30px auto 0 auto; color:#555;"> 
<div style="clear:both; height:0; line-height:0; overflow:hidden"></div> 

<% 
    String strURL = PortletURLHelper.generateSinglePortletRenderURL(params, null, null, renderRequest, renderResponse); 
%> 
<a href='<%=strURL%>' id="mb11" class="mb" title="This is shown when hover the link and as a title for multibox dialog" rel="width:600,height:400">This is the link which opens multibox dialog</a> 
<div class="multiBoxDesc mb11 mbHidden">This is shown as description (subtitle) for multibox dialog</div> 
</body> 

  1. /Feedback/WebContent/_Feedback/multibox/files/feedbackform.jsp仅仅是基于JSP多箱捆绑HTML页面(blank.htm文件)上,这是怎么回事MultiBox的内部显示对话。
  2. 这使用文章Portal 6.1 and 7.0 Advanced URL Generation Helper classes中附带的库(感谢@ udo-held for the link)。
  3. multibox zip文件的内容被提取到/ Feedback/WebContent/_Feedback,保留文件结构。
相关问题