Home
Analytics
BIRT Portlet help
StaringOx
I've been looking on the website and around on the internet trying to figure out how to set up a portlet on Liferay that has an embedded BIRT report. I've got a portlet that contains links that open up another page containing the report, but I really need to have the reports available in the portlet. I saw some suggestions on the forum for doing this in iPortal I believe, but I really need to integrate it into a Liferay portal. Any help would be awesome.
Portal: Liferay 5.2.3
Server: Tomcat 6.0.18
- Derek
Find more posts tagged with
Comments
JasonW
Did you see this thread on liferay?
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/352731
JasonW
Also see this example in the market place:
http://www.birt-exchange.com/be/marketplace/app-showcase/?app=27
Jason
StaringOx
I've figured out how to get it into the portlet (after I found the tags for the birt-viewer), but now I am trying to get multiple reports to render in different instances of the same portlet. I've checked to make sure the viewer is getting the right report file, but they don't render right. It appears that the first portlet rendered will have the report specified in the last rendered portlet and none of the other portlets show anything. I don't get the 'need to specify report' error so they are pointing to reports, but just not showing them properly. If I go to the edit page on one report (custom page that lets user choose report) then the other report will render just fine, this makes it appear that somehow one portlet is affected the other. Here is my source JSP code that is called when in view mode.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/birt.tld" prefix="birt"%>
<%
@page
import="javax.portlet.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Viewer</title>
</head>
<body>
<% String name = ((javax.portlet.RenderResponse)request.getAttribute("javax.portlet.response")).getNamespace();
name = name + "fileName";%><%=name%><%
PortletPreferences prefs =(PortletPreferences) request.getAttribute("prefs");
name = prefs.getValue(name,"miss");
%>
<%=name %>
<birt:viewer id="birtViewer" baseURL="/birt-viewer"
reportDesign="<%=name %>" pattern="frameset"
height="450" width="800" format="html" isHostPage="false"></birt:viewer>
</body>
</html>
</pre>
In the above code the 'prefs' attribute is used to contain a mapping of each portlet namespace to the corresponding report. I just pass this to the jsp so that every instance of the portlet will have access to every report and then can choose the correct one based on its namespace. The prefs attribute is set in the doView() method by just running through a database that contains the pairs.<br />
<br />
<br />
Thanks in advance for any help with this issue.<br />
-Derek
JasonW
Can you try changing viewer id for each instance?
Jason
StaringOx
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="65419" data-time="1276117591" data-date="09 June 2010 - 02:06 PM"><p>
Can you try changing viewer id for each instance?<br />
<br />
Jason<br /></p></blockquote>
I tried to make the viewer ids unique by incorporating the namespace, but then I get an error that the viewer ids have to be unique. It's kind of counterintuitive. I really don't understand that error.<br />
<br />
edit--Nevermind, I went and tried it again after you suggested it and now it works. Don't know what was happening before, but thank you for the help.<br />
<br />
Derek