Skip to main content



      Home
Home » Archived » BIRT » AppContext Example
AppContext Example [message #261676] Mon, 19 November 2007 13:16 Go to next message
Eclipse UserFriend
Hi,

I've ran the AppContext example I found on the web.
The following works if I just call it directly, but it doesn't work if I
invoke it thru a form (or invoke it thru another servlet).
How come?

i.e. http://localhost:8080/AppContextTest works, the BIRT report got the
attribute that's set in the AppContext.jsp
AppContext.jsp
----------------
<%
request.setAttribute( "myAttribute", "hellohello" );
%>
<jsp:forward page= "<%= "/frameset?__report=AppContext.rptdesign" %>"/>

my web.xml
-------------
<servlet>
<servlet-name>AppContextServlet</servlet-name>
<jsp-file>/AppContext.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>AppContextServlet</servlet-name>
<url-pattern>/AppContextTest</url-pattern>
</servlet-mapping>

The following didn't work, note that the form is linked to 'AppContextTest'
===================================================
After I click the submit button on http://localhost:8080/login (which is
linked to AppContextServlet),
the BIRT report got invoked but it didn't get the attribute that is set in
the AppContext.jsp.

index.jsp
---------
<head>
</head>
<body bgcolor='white'>
<table>
<form action='AppContextTest' method='post'>
<table>
<tr>
<td>Name:
<td><input name='username'>
<tr>
<td>Password:
<td><input name='password' type='password'>
<tr>
<td><input type=submit value='Login'>
</table>
</form>
</table>
</body>


my web.xml
------------

<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>Login</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>

<servlet>
<servlet-name>AppContextServlet</servlet-name>
<jsp-file>/AppContext.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>AppContextServlet</servlet-name>
<url-pattern>/AppContextTest</url-pattern>
</servlet-mapping>


Maria.
Re: AppContext Example [message #261680 is a reply to message #261676] Mon, 19 November 2007 13:21 Go to previous messageGo to next message
Eclipse UserFriend
Forgot to mention.

I'm using BIRT 2.2.1, and I'm using the BIRT Viewer Serlvet (the
WebViewerExample).
It's deployed on JBOSS as a war file.

I'm trying to have an existing servlet passing attribute to the BIRT Viewer
Servlet.

Maria.

"Maria" <mollylatipinna@hotmail.com> wrote in message
news:fhsk1o$kob$1@build.eclipse.org...
> Hi,
>
> I've ran the AppContext example I found on the web.
> The following works if I just call it directly, but it doesn't work if I
> invoke it thru a form (or invoke it thru another servlet).
> How come?
>
> i.e. http://localhost:8080/AppContextTest works, the BIRT report got the
> attribute that's set in the AppContext.jsp
> AppContext.jsp
> ----------------
> <%
> request.setAttribute( "myAttribute", "hellohello" );
> %>
> <jsp:forward page= "<%= "/frameset?__report=AppContext.rptdesign" %>"/>
>
> my web.xml
> -------------
> <servlet>
> <servlet-name>AppContextServlet</servlet-name>
> <jsp-file>/AppContext.jsp</jsp-file>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>AppContextServlet</servlet-name>
> <url-pattern>/AppContextTest</url-pattern>
> </servlet-mapping>
>
> The following didn't work, note that the form is linked to
> 'AppContextTest'
> ===================================================
> After I click the submit button on http://localhost:8080/login (which is
> linked to AppContextServlet),
> the BIRT report got invoked but it didn't get the attribute that is set in
> the AppContext.jsp.
>
> index.jsp
> ---------
> <head>
> </head>
> <body bgcolor='white'>
> <table>
> <form action='AppContextTest' method='post'>
> <table>
> <tr>
> <td>Name:
> <td><input name='username'>
> <tr>
> <td>Password:
> <td><input name='password' type='password'>
> <tr>
> <td><input type=submit value='Login'>
> </table>
> </form>
> </table>
> </body>
>
>
> my web.xml
> ------------
>
> <servlet-mapping>
> <servlet-name>Login</servlet-name>
> <url-pattern>/login</url-pattern>
> </servlet-mapping>
>
> <servlet>
> <servlet-name>Login</servlet-name>
> <jsp-file>/index.jsp</jsp-file>
> </servlet>
>
> <servlet>
> <servlet-name>AppContextServlet</servlet-name>
> <jsp-file>/AppContext.jsp</jsp-file>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>AppContextServlet</servlet-name>
> <url-pattern>/AppContextTest</url-pattern>
> </servlet-mapping>
>
>
> Maria.
>
Re: AppContext Example [message #261688 is a reply to message #261680] Mon, 19 November 2007 13:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Maria,

Can you try adding the attribute to session instead of the request?
In script you should be able to access the session objects like:

var session =reportContext.getHttpServletRequest().getSession();
myattrib = session.getAttribute("myattrib");


Jason


Maria wrote:
> Forgot to mention.
>
> I'm using BIRT 2.2.1, and I'm using the BIRT Viewer Serlvet (the
> WebViewerExample).
> It's deployed on JBOSS as a war file.
>
> I'm trying to have an existing servlet passing attribute to the BIRT Viewer
> Servlet.
>
> Maria.
>
> "Maria" <mollylatipinna@hotmail.com> wrote in message
> news:fhsk1o$kob$1@build.eclipse.org...
>> Hi,
>>
>> I've ran the AppContext example I found on the web.
>> The following works if I just call it directly, but it doesn't work if I
>> invoke it thru a form (or invoke it thru another servlet).
>> How come?
>>
>> i.e. http://localhost:8080/AppContextTest works, the BIRT report got the
>> attribute that's set in the AppContext.jsp
>> AppContext.jsp
>> ----------------
>> <%
>> request.setAttribute( "myAttribute", "hellohello" );
>> %>
>> <jsp:forward page= "<%= "/frameset?__report=AppContext.rptdesign" %>"/>
>>
>> my web.xml
>> -------------
>> <servlet>
>> <servlet-name>AppContextServlet</servlet-name>
>> <jsp-file>/AppContext.jsp</jsp-file>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>AppContextServlet</servlet-name>
>> <url-pattern>/AppContextTest</url-pattern>
>> </servlet-mapping>
>>
>> The following didn't work, note that the form is linked to
>> 'AppContextTest'
>> ===================================================
>> After I click the submit button on http://localhost:8080/login (which is
>> linked to AppContextServlet),
>> the BIRT report got invoked but it didn't get the attribute that is set in
>> the AppContext.jsp.
>>
>> index.jsp
>> ---------
>> <head>
>> </head>
>> <body bgcolor='white'>
>> <table>
>> <form action='AppContextTest' method='post'>
>> <table>
>> <tr>
>> <td>Name:
>> <td><input name='username'>
>> <tr>
>> <td>Password:
>> <td><input name='password' type='password'>
>> <tr>
>> <td><input type=submit value='Login'>
>> </table>
>> </form>
>> </table>
>> </body>
>>
>>
>> my web.xml
>> ------------
>>
>> <servlet-mapping>
>> <servlet-name>Login</servlet-name>
>> <url-pattern>/login</url-pattern>
>> </servlet-mapping>
>>
>> <servlet>
>> <servlet-name>Login</servlet-name>
>> <jsp-file>/index.jsp</jsp-file>
>> </servlet>
>>
>> <servlet>
>> <servlet-name>AppContextServlet</servlet-name>
>> <jsp-file>/AppContext.jsp</jsp-file>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>AppContextServlet</servlet-name>
>> <url-pattern>/AppContextTest</url-pattern>
>> </servlet-mapping>
>>
>>
>> Maria.
>>
>
>
Re: AppContext Example [message #261697 is a reply to message #261688] Mon, 19 November 2007 14:42 Go to previous message
Eclipse UserFriend
setting it in session works.

Thanks :)

Maria

"Jason Weathersby" <jasonweathersby@alltel.net> wrote in message
news:fhslju$t5r$2@build.eclipse.org...
> Maria,
>
> Can you try adding the attribute to session instead of the request?
> In script you should be able to access the session objects like:
>
> var session =reportContext.getHttpServletRequest().getSession();
> myattrib = session.getAttribute("myattrib");
>
>
> Jason
>
>
> Maria wrote:
>> Forgot to mention.
>>
>> I'm using BIRT 2.2.1, and I'm using the BIRT Viewer Serlvet (the
>> WebViewerExample).
>> It's deployed on JBOSS as a war file.
>>
>> I'm trying to have an existing servlet passing attribute to the BIRT
>> Viewer Servlet.
>>
>> Maria.
>>
>> "Maria" <mollylatipinna@hotmail.com> wrote in message
>> news:fhsk1o$kob$1@build.eclipse.org...
>>> Hi,
>>>
>>> I've ran the AppContext example I found on the web.
>>> The following works if I just call it directly, but it doesn't work if I
>>> invoke it thru a form (or invoke it thru another servlet).
>>> How come?
>>>
>>> i.e. http://localhost:8080/AppContextTest works, the BIRT report got the
>>> attribute that's set in the AppContext.jsp
>>> AppContext.jsp
>>> ----------------
>>> <%
>>> request.setAttribute( "myAttribute", "hellohello" );
>>> %>
>>> <jsp:forward page= "<%= "/frameset?__report=AppContext.rptdesign" %>"/>
>>>
>>> my web.xml
>>> -------------
>>> <servlet>
>>> <servlet-name>AppContextServlet</servlet-name>
>>> <jsp-file>/AppContext.jsp</jsp-file>
>>> </servlet>
>>>
>>> <servlet-mapping>
>>> <servlet-name>AppContextServlet</servlet-name>
>>> <url-pattern>/AppContextTest</url-pattern>
>>> </servlet-mapping>
>>>
>>> The following didn't work, note that the form is linked to
>>> 'AppContextTest'
>>> ===================================================
>>> After I click the submit button on http://localhost:8080/login (which is
>>> linked to AppContextServlet),
>>> the BIRT report got invoked but it didn't get the attribute that is set
>>> in the AppContext.jsp.
>>>
>>> index.jsp
>>> ---------
>>> <head>
>>> </head>
>>> <body bgcolor='white'>
>>> <table>
>>> <form action='AppContextTest' method='post'>
>>> <table>
>>> <tr>
>>> <td>Name:
>>> <td><input name='username'>
>>> <tr>
>>> <td>Password:
>>> <td><input name='password' type='password'>
>>> <tr>
>>> <td><input type=submit value='Login'>
>>> </table>
>>> </form>
>>> </table>
>>> </body>
>>>
>>>
>>> my web.xml
>>> ------------
>>>
>>> <servlet-mapping>
>>> <servlet-name>Login</servlet-name>
>>> <url-pattern>/login</url-pattern>
>>> </servlet-mapping>
>>>
>>> <servlet>
>>> <servlet-name>Login</servlet-name>
>>> <jsp-file>/index.jsp</jsp-file>
>>> </servlet>
>>>
>>> <servlet>
>>> <servlet-name>AppContextServlet</servlet-name>
>>> <jsp-file>/AppContext.jsp</jsp-file>
>>> </servlet>
>>>
>>> <servlet-mapping>
>>> <servlet-name>AppContextServlet</servlet-name>
>>> <url-pattern>/AppContextTest</url-pattern>
>>> </servlet-mapping>
>>>
>>>
>>> Maria.
>>>
>>
Previous Topic:IResultMetaData.getColumnLabel(int index) does not return display name
Next Topic:Sub totals per page
Goto Forum:
  


Current Time: Sun May 11 20:55:44 EDT 2025

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

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

Back to the top