Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Pass Java Object to Birt Viewer
Pass Java Object to Birt Viewer [message #247518] Thu, 12 July 2007 05:24 Go to next message
Eclipse UserFriend
Originally posted by: rupeshkp.gmail.com

I am working on integrating birt reporting framework with WebWork based
web application. I am trying to solve following integration scenario and
got it working as mentioned below:

Use case scenario
-------------------
1. There is a search screen that has many search parameters as input text
fields
2. The submitted request (HTTP POST) is handled by an action class and
finally the result is made available in the form of a collection (as an
attribute of action class)
3. Now I want this collection result to feed to birt viewer

Suggested solutions from newsgroup
------------------------------------

I searched the news group and this is what I got:

The engine API has a function in the IEngineTask interface:
public void addScriptableJavaObject(String jsName, Object obj);

This allows you to register an object (i.e., sesion context) and give it a
name (say, myContext), so that you can write myContext.foo() in your
scripting code.

Problem: This solution will work as long as we are executing the report
task but as I mentioned earlier, action class simply passes control to
Birt Viewer servlet. This means the suggested solution is not applicable
in this case as we are not executing report task.

Solution (Use HttpSession)
-------- ---------
1. Action class puts the collection object into http session (say with
attribute "javaBean")
2. Now it forwards the request to Birt viewer (i.e. viewerServlet) by
appending report name (.rptdesign file). The reason we put collection data
in session and not in request is because: BIRt viewer will send AJAX based
request to fetch report data.

3. Within the report design file, I have added following event handler
code associated with dataset

a) beforeOpen: dataCollection =
reportContext.getHttpservletRequest().getSession().getAttrib ute( "javaBean");
b) fetch: here I can traverse the dataCollection

This solution works but doesn't work out well since we are using session
to share data. Additionally this data cannot be removed from session (at
afterClose event) because one may want to perform column sorting when
viewing report.

Is there a better way to solve this problem ? Any pointers/code sample
will be of great help.
Re: Pass Java Object to Birt Viewer [message #247616 is a reply to message #247518] Thu, 12 July 2007 13:31 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Rupesh,

Take a look at this example:
http://wiki.eclipse.org/Adding_an_Object_to_the_Application_ Context_for_the_Viewer_%28BIRT%29

Jason

Rupesh wrote:
> I am working on integrating birt reporting framework with WebWork based
> web application. I am trying to solve following integration scenario and
> got it working as mentioned below:
> Use case scenario ------------------- 1. There is a search screen that
> has many search parameters as input text fields 2. The submitted request
> (HTTP POST) is handled by an action class and finally the result is made
> available in the form of a collection (as an attribute of action class)
> 3. Now I want this collection result to feed to birt viewer
> Suggested solutions from newsgroup
> ------------------------------------
>
> I searched the news group and this is what I got:
>
> The engine API has a function in the IEngineTask interface:
> public void addScriptableJavaObject(String jsName, Object obj);
>
> This allows you to register an object (i.e., sesion context) and give it
> a name (say, myContext), so that you can write myContext.foo() in your
> scripting code.
> Problem: This solution will work as long as we are executing the report
> task but as I mentioned earlier, action class simply passes control to
> Birt Viewer servlet. This means the suggested solution is not applicable
> in this case as we are not executing report task.
>
> Solution (Use HttpSession)
> -------- ---------
> 1. Action class puts the collection object into http session (say with
> attribute "javaBean") 2. Now it forwards the request to Birt viewer
> (i.e. viewerServlet) by appending report name (.rptdesign file). The
> reason we put collection data in session and not in request is because:
> BIRt viewer will send AJAX based request to fetch report data.
>
> 3. Within the report design file, I have added following event handler
> code associated with dataset
> a) beforeOpen: dataCollection =
> reportContext.getHttpservletRequest().getSession().getAttrib ute( "javaBean");
> b) fetch: here I can traverse the dataCollection
> This solution works but doesn't work out well since we are using session
> to share data. Additionally this data cannot be removed from session (at
> afterClose event) because one may want to perform column sorting when
> viewing report.
> Is there a better way to solve this problem ? Any pointers/code sample
> will be of great help.
>
Previous Topic:Report View throwing exception on Fedora
Next Topic:Question on group header
Goto Forum:
  


Current Time: Tue Jul 16 09:19:29 GMT 2024

Powered by FUDForum. Page generated in 0.03709 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top