AppContext Example [message #261676] |
Mon, 19 November 2007 13:16  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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.
>>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.06058 seconds