Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » how to get session attribute into reportContext?
how to get session attribute into reportContext? [message #245804] Mon, 02 July 2007 07:02 Go to next message
Eclipse UserFriend
Originally posted by: amit.rajpurkar.pepsico.com.au

Hi,

I am trying to get a java object from HttpSession in the report file.

in the DataSet's open method:
importPackage(Packages.au.com.pepsico.birt.data);
importPackage(Packages.javax.servlet.http);
var listFromSession =
reportContext.getHttpSession().getAttribute("CONTENTLIST");
iter = listFromSession.iterator();


Am i missing something in the code???

Regards,
-Amit
Re: how to get session attribute into reportContext? [message #245926 is a reply to message #245804] Mon, 02 July 2007 14:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Amit,

This looks correct. What error are you getting?

Jason

Amit Rajpurkar wrote:
> Hi,
>
> I am trying to get a java object from HttpSession in the report file.
>
> in the DataSet's open method:
> importPackage(Packages.au.com.pepsico.birt.data);
> importPackage(Packages.javax.servlet.http);
> var listFromSession =
> reportContext.getHttpSession().getAttribute("CONTENTLIST");
> iter = listFromSession.iterator();
>
>
> Am i missing something in the code???
>
> Regards,
> -Amit
>
Re: how to get session attribute into reportContext? [message #246009 is a reply to message #245926] Mon, 02 July 2007 23:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: amit.rajpurkar.pepsico.com.au

Hi Jason,

Here was the error i got:
Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT
exception occurred: Error evaluating Javascript expression. Script engine
error: TypeError: getHttpSession is not a function. (DataSet[Data
Set].__bm_OPEN#6)

now i have changed this code to:
importPackage(Packages.au.com.pepsico.birt.data);
importPackage(Packages.javax.servlet.http);
importPackage(Packages.javax.servlet);

var request = reportContext.getHttpServletRequest();
var session = request.getSession();
var listFromSession = session.getAttribute("CONTENTLIST");
if(listFromSession != null){
iter = listFromSession.iterator();
}

this took away the error, but the report does not work.

i am using BIRT RCP designer 2.1.1 to develop reports. I use these reports
in a simple web application, in which a servlet calls a report design.

I found one more link:
http://wiki.eclipse.org/Retrieve_Session_information_in_Scri pt_(BIRT)

The sample i made following the above link works good in the preview
section of the designer;
But when i place the report in my web application, it shows a blank page.

From the servlet do i need to do something to send the session attributes
into the report?.


Regards,
-Amit
Re: how to get session attribute into reportContext? [message #246046 is a reply to message #246009] Tue, 03 July 2007 03:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Amit,

I tried this report with BIRT 2.1.2 deployed to tomcat and it worked
fine. This may be an issue with 2.1.1.

Jason

Amit Rajpurkar wrote:
> Hi Jason,
>
> Here was the error i got:
> Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT
> exception occurred: Error evaluating Javascript expression. Script
> engine error: TypeError: getHttpSession is not a function. (DataSet[Data
> Set].__bm_OPEN#6)
>
> now i have changed this code to:
> importPackage(Packages.au.com.pepsico.birt.data);
> importPackage(Packages.javax.servlet.http);
> importPackage(Packages.javax.servlet);
>
> var request = reportContext.getHttpServletRequest();
> var session = request.getSession();
> var listFromSession = session.getAttribute("CONTENTLIST");
> if(listFromSession != null){
> iter = listFromSession.iterator();
> }
>
> this took away the error, but the report does not work.
>
> i am using BIRT RCP designer 2.1.1 to develop reports. I use these
> reports in a simple web application, in which a servlet calls a report
> design.
>
> I found one more link:
> http://wiki.eclipse.org/Retrieve_Session_information_in_Scri pt_(BIRT)
>
> The sample i made following the above link works good in the preview
> section of the designer; But when i place the report in my web
> application, it shows a blank page.
>
> From the servlet do i need to do something to send the session
> attributes into the report?.
>
>
> Regards,
> -Amit
>
Re: how to get session attribute into reportContext? [message #246107 is a reply to message #246046] Tue, 03 July 2007 09:07 Go to previous message
Eclipse UserFriend
Originally posted by: amit.rajpurkar.pepsico.com.au

Hi Jason,

It must be with version 2.1.1
We surely work in different time zones.

In the meantime today i search a lot and found some more useful links:
http://birtworld.blogspot.com/2006_03_01_archive.html
http://dev.eclipse.org/newslists/news.eclipse.birt/msg07596. html
http://www.ji.co.za/unplugged/?p=37
http://dev.eclipse.org/newslists/news.eclipse.birt/msg05292. html
http://birtworld.blogspot.com/2005/11/using-embedded-java-ob jects-within.html

the last one resolved my issue.
Within the servlet which calls my report design files, i added:
task.addScriptableJavaObject("MYLIST",sampleContent);

..and retrived this object in the report file.

This resolved my issue -- so instead of passing java object thru session,
i passed it this way. i am was able to get the POC up and running by the
evening.

I do have a serious comment though -- searching documents/references, etc
on BIRT site is a nightmare !!! But this newsgroup is definately useful :-)

Regards,
-Amit
Previous Topic:Blank page issue with Birt 2.1.2
Next Topic:BIRT 2.2 - "Can't re-generate content" errors
Goto Forum:
  


Current Time: Tue Nov 12 19:40:36 GMT 2024

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

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

Back to the top