You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mosho <ro...@gmail.com> on 2006/09/25 06:48:15 UTC

Question about session time-out using Listener


Hi All,

When session times out I want to forward a request to another page.Is it
possible to do it with HttpSessionListener? 
How can I get response object so that I can redirect to another page?

Thanks for your  help!
-- 
View this message in context: http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Question about session time-out using Listener

Posted by Tamas Szabo <sz...@gmail.com>.
Hi,

Sorry, I had to sleep in the meantime ;-).

Yes, of course you will need to have the SessionInactivityFilter and it's
dependencies in your webapp.
The easiest is probably to just include the jar containing it. To do that
get the binary distribution of JWP:

http://prdownloads.sourceforge.net/javawebparts/javawebparts-1.0-beta6-bin.zip?download

Unzip it, you will have the javawebparts directory in it which is an
exploded WAR.

Go to javawebparts/WEB-INF/lib, you will see all the components jared by
package.
You'll need the javawebparts-filter-1.0-beta6.jar so just copy it from
javawebparts/WEB-INF/lib to your web applications WEB-INF/lib.
Leave your web.xml as it is (e.g. filter and filter-mapping elements
configured yesterday) and it should work now.

Sorry, if the process isn't straightforward, maybe it's time for us to
update the FAQ, with instructions on how to set up things.

Hope it will all be fine now,

Tamas


On 9/26/06, mosho <ro...@gmail.com> wrote:
>
>
> Hi Tamas
>
> I am getting this error. do I need to inculde class
> SessionInactivityFilter
> or implement this class. I didn't understand how it is going to work.
>
> Servlet error: Error loading filter 'SessionInactivityFilter',
> filter-class
> 'javawebparts.filter.SessionInactivityFilter' not found
>
> This is how my web.xml looks like;
> <filter>
>     <filter-name>SessionInactivityFilter</filter-name>
>     <filter-class>javawebparts.filter.SessionInactivityFilter
> </filter-class>
>     <init-param>
>      <param-name>forwardTo</param-name>
>      <param-value>/sessionError.do</param-value>
>     </init-param>
>   </filter>
>   <filter-mapping>
>      <filter-name>SessionInactivityFilter</filter-name>
>      <url-pattern>/*</url-pattern>
>   </filter-mapping>
>
>
>
> Tamas Szabo wrote:
> >
> > Did you also map the filter to /* with a filter-mapping?
> >
> > Just after the filter element you declared you should have:
> >
> > <filter-mapping>
> >   <filter-name>SessionInactivityFilter< /filter-name>
> >   <url-pattern>/*</url-pattern>
> > </filter-mapping>
> >
> >  This is the first think I can think of.
> >
> > If you think that you got that right it would be good if I could see
> your
> > whole web.xml file.
> >
> > Tamas
> >
> >
> >
> >
> > On 9/25/06, mosho <ro...@gmail.com> wrote:
> >>
> >>
> >> Thanks Tamas. That seems to get rid of the errors but it doesn't work.
> >> When
> >> the session expires, it doesn't take me to any page, I tried forwarding
> >> to
> >> struts actions and .jsp files, it doesn;t work for both. Any idea?
> >>
> >>   <filter>
> >>     <filter-name>SessionInactivityFilter</filter-name>
> >>     <filter-class>javawebparts.filter.SessionInactivityFilter
> >> </filter-class>
> >>     <init-param>
> >>      <param-name>forwardTo</param-name>
> >>      <param-value>/sessionError.do</param-value>
> >>     </init-param>
> >>   </filter>
> >>
> >>
> >> Tamas Szabo wrote:
> >> >
> >> > Yes, you probably just added the filter at the end of the web.xml,
> >> after
> >> > the
> >> > <error-page> element that you already had in there.
> >> >
> >> > You have to declare the elements in the order defined by the DTD.
> >> > For 2.3 this is:
> >> >
> >> > <!ELEMENT web-app (icon?, display-name?, description?,
> distributable?,
> >> > context-param*, filter*, filter-mapping*, listener*, servlet*,
> >> > servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
> >> > error-page*, taglib*, resource-env-ref*, resource-ref*,
> >> > security-constraint*,
> >> > login-config?, security-role*, env-entry*,
> ejb-ref*,  ejb-local-ref*)>
> >> >
> >> > So try to have the declaration of the filter and filter-mapping just
> >> > before
> >> > the listener elements or  the servlet element if you don't have any
> >> > listeners declared.
> >> >
> >> > Please don't hesitate to contact us if you have any other problems.
> >> >
> >> > Tamas
> >> >
> >> >
> >> >
> >> >
> >> > On 9/25/06, mosho <ro...@gmail.com> wrote:
> >> >>
> >> >>
> >> >> Thanks for all your replies.
> >> >> My application is a struts application. I tried to use
> >> >> SessionInactivityFilter, i am getting compilation errors.
> >> >> I just have to include the following in my xml file or I need to do
> >> >> something else also:
> >> >>
> >> >> <filter>
> >> >>   <filter-name>SessionInactivityFilter</filter-name>
> >> >>
> >> >> <filter-class>javawebparts.filter.SessionInactivityFilter
> >> </filter-class>
> >> >>   <init-param>
> >> >>     <param-name>forwardTo</param-name>
> >> >>     <param-value>/session_expired.jsp</param-value>
> >> >>   </init-param>
> >> >> </filter>
> >> >>
> >> >> I get the following error:
> >> >> Error(108,9): Invalid element 'filter' in content of 'web-app',
> >> expected
> >> >> elements '[taglib, resource-env-ref, resource-ref,
> >> security-constraint,
> >> >> login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.
> >> >>
> >> >>
> >> >> Tamas Szabo wrote:
> >> >> >
> >> >> > Hi,
> >> >> >
> >> >> > You can use SessionInactivityFilter from the JavaWebParts project
> if
> >> >> you
> >> >> > don't want to reinvent the wheel:
> >> >> >
> >> >> > Doc:
> >> >> >
> >> >>
> >>
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> >> >> >
> >> >> > JWP Home Page:
> >> >> > http://javawebparts.sourceforge.net/
> >> >> >
> >> >> > Good Luck,
> >> >> >
> >> >> > Tamas
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >>
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> >> >> >
> >> >> > On 9/25/06, mosho <ro...@gmail.com> wrote:
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> Hi All,
> >> >> >>
> >> >> >> When session times out I want to forward a request to another
> >> >> page.Isit
> >> >> >> possible to do it with HttpSessionListener?
> >> >> >> How can I get response object so that I can redirect to another
> >> page?
> >> >> >>
> >> >> >> Thanks for your  help!
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >>
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
> >> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >> >> For additional commands, e-mail: user-help@struts.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6486905
> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@struts.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6488051
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6489959
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Question about session time-out using Listener

Posted by mosho <ro...@gmail.com>.
Hi Tamas

I am getting this error. do I need to inculde class SessionInactivityFilter
or implement this class. I didn't understand how it is going to work.

Servlet error: Error loading filter 'SessionInactivityFilter', filter-class
'javawebparts.filter.SessionInactivityFilter' not found

This is how my web.xml looks like;
<filter>
    <filter-name>SessionInactivityFilter</filter-name>
    <filter-class>javawebparts.filter.SessionInactivityFilter</filter-class>
    <init-param>
     <param-name>forwardTo</param-name>
     <param-value>/sessionError.do</param-value>
    </init-param>
  </filter> 
  <filter-mapping>
     <filter-name>SessionInactivityFilter</filter-name>
     <url-pattern>/*</url-pattern>
  </filter-mapping>
  


Tamas Szabo wrote:
> 
> Did you also map the filter to /* with a filter-mapping?
> 
> Just after the filter element you declared you should have:
> 
> <filter-mapping>
>   <filter-name>SessionInactivityFilter< /filter-name>
>   <url-pattern>/*</url-pattern>
> </filter-mapping>
> 
>  This is the first think I can think of.
> 
> If you think that you got that right it would be good if I could see your
> whole web.xml file.
> 
> Tamas
> 
> 
> 
> 
> On 9/25/06, mosho <ro...@gmail.com> wrote:
>>
>>
>> Thanks Tamas. That seems to get rid of the errors but it doesn't work.
>> When
>> the session expires, it doesn't take me to any page, I tried forwarding
>> to
>> struts actions and .jsp files, it doesn;t work for both. Any idea?
>>
>>   <filter>
>>     <filter-name>SessionInactivityFilter</filter-name>
>>     <filter-class>javawebparts.filter.SessionInactivityFilter
>> </filter-class>
>>     <init-param>
>>      <param-name>forwardTo</param-name>
>>      <param-value>/sessionError.do</param-value>
>>     </init-param>
>>   </filter>
>>
>>
>> Tamas Szabo wrote:
>> >
>> > Yes, you probably just added the filter at the end of the web.xml,
>> after
>> > the
>> > <error-page> element that you already had in there.
>> >
>> > You have to declare the elements in the order defined by the DTD.
>> > For 2.3 this is:
>> >
>> > <!ELEMENT web-app (icon?, display-name?, description?, distributable?,
>> > context-param*, filter*, filter-mapping*, listener*, servlet*,
>> > servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
>> > error-page*, taglib*, resource-env-ref*, resource-ref*,
>> > security-constraint*,
>> > login-config?, security-role*, env-entry*, ejb-ref*,  ejb-local-ref*)>
>> >
>> > So try to have the declaration of the filter and filter-mapping just
>> > before
>> > the listener elements or  the servlet element if you don't have any
>> > listeners declared.
>> >
>> > Please don't hesitate to contact us if you have any other problems.
>> >
>> > Tamas
>> >
>> >
>> >
>> >
>> > On 9/25/06, mosho <ro...@gmail.com> wrote:
>> >>
>> >>
>> >> Thanks for all your replies.
>> >> My application is a struts application. I tried to use
>> >> SessionInactivityFilter, i am getting compilation errors.
>> >> I just have to include the following in my xml file or I need to do
>> >> something else also:
>> >>
>> >> <filter>
>> >>   <filter-name>SessionInactivityFilter</filter-name>
>> >>
>> >> <filter-class>javawebparts.filter.SessionInactivityFilter
>> </filter-class>
>> >>   <init-param>
>> >>     <param-name>forwardTo</param-name>
>> >>     <param-value>/session_expired.jsp</param-value>
>> >>   </init-param>
>> >> </filter>
>> >>
>> >> I get the following error:
>> >> Error(108,9): Invalid element 'filter' in content of 'web-app',
>> expected
>> >> elements '[taglib, resource-env-ref, resource-ref,
>> security-constraint,
>> >> login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.
>> >>
>> >>
>> >> Tamas Szabo wrote:
>> >> >
>> >> > Hi,
>> >> >
>> >> > You can use SessionInactivityFilter from the JavaWebParts project if
>> >> you
>> >> > don't want to reinvent the wheel:
>> >> >
>> >> > Doc:
>> >> >
>> >>
>> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
>> >> >
>> >> > JWP Home Page:
>> >> > http://javawebparts.sourceforge.net/
>> >> >
>> >> > Good Luck,
>> >> >
>> >> > Tamas
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
>> >> >
>> >> > On 9/25/06, mosho <ro...@gmail.com> wrote:
>> >> >>
>> >> >>
>> >> >>
>> >> >> Hi All,
>> >> >>
>> >> >> When session times out I want to forward a request to another
>> >> page.Isit
>> >> >> possible to do it with HttpSessionListener?
>> >> >> How can I get response object so that I can redirect to another
>> page?
>> >> >>
>> >> >> Thanks for your  help!
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
>> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> >> For additional commands, e-mail: user-help@struts.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6486905
>> >> Sent from the Struts - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6488051
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6489959
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Question about session time-out using Listener

Posted by Tamas Szabo <sz...@gmail.com>.
Did you also map the filter to /* with a filter-mapping?

Just after the filter element you declared you should have:

<filter-mapping>
  <filter-name>SessionInactivityFilter< /filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

 This is the first think I can think of.

If you think that you got that right it would be good if I could see your
whole web.xml file.

Tamas




On 9/25/06, mosho <ro...@gmail.com> wrote:
>
>
> Thanks Tamas. That seems to get rid of the errors but it doesn't work.
> When
> the session expires, it doesn't take me to any page, I tried forwarding to
> struts actions and .jsp files, it doesn;t work for both. Any idea?
>
>   <filter>
>     <filter-name>SessionInactivityFilter</filter-name>
>     <filter-class>javawebparts.filter.SessionInactivityFilter
> </filter-class>
>     <init-param>
>      <param-name>forwardTo</param-name>
>      <param-value>/sessionError.do</param-value>
>     </init-param>
>   </filter>
>
>
> Tamas Szabo wrote:
> >
> > Yes, you probably just added the filter at the end of the web.xml, after
> > the
> > <error-page> element that you already had in there.
> >
> > You have to declare the elements in the order defined by the DTD.
> > For 2.3 this is:
> >
> > <!ELEMENT web-app (icon?, display-name?, description?, distributable?,
> > context-param*, filter*, filter-mapping*, listener*, servlet*,
> > servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
> > error-page*, taglib*, resource-env-ref*, resource-ref*,
> > security-constraint*,
> > login-config?, security-role*, env-entry*, ejb-ref*,  ejb-local-ref*)>
> >
> > So try to have the declaration of the filter and filter-mapping just
> > before
> > the listener elements or  the servlet element if you don't have any
> > listeners declared.
> >
> > Please don't hesitate to contact us if you have any other problems.
> >
> > Tamas
> >
> >
> >
> >
> > On 9/25/06, mosho <ro...@gmail.com> wrote:
> >>
> >>
> >> Thanks for all your replies.
> >> My application is a struts application. I tried to use
> >> SessionInactivityFilter, i am getting compilation errors.
> >> I just have to include the following in my xml file or I need to do
> >> something else also:
> >>
> >> <filter>
> >>   <filter-name>SessionInactivityFilter</filter-name>
> >>
> >> <filter-class>javawebparts.filter.SessionInactivityFilter
> </filter-class>
> >>   <init-param>
> >>     <param-name>forwardTo</param-name>
> >>     <param-value>/session_expired.jsp</param-value>
> >>   </init-param>
> >> </filter>
> >>
> >> I get the following error:
> >> Error(108,9): Invalid element 'filter' in content of 'web-app',
> expected
> >> elements '[taglib, resource-env-ref, resource-ref, security-constraint,
> >> login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.
> >>
> >>
> >> Tamas Szabo wrote:
> >> >
> >> > Hi,
> >> >
> >> > You can use SessionInactivityFilter from the JavaWebParts project if
> >> you
> >> > don't want to reinvent the wheel:
> >> >
> >> > Doc:
> >> >
> >>
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> >> >
> >> > JWP Home Page:
> >> > http://javawebparts.sourceforge.net/
> >> >
> >> > Good Luck,
> >> >
> >> > Tamas
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> >> >
> >> > On 9/25/06, mosho <ro...@gmail.com> wrote:
> >> >>
> >> >>
> >> >>
> >> >> Hi All,
> >> >>
> >> >> When session times out I want to forward a request to another
> >> page.Isit
> >> >> possible to do it with HttpSessionListener?
> >> >> How can I get response object so that I can redirect to another
> page?
> >> >>
> >> >> Thanks for your  help!
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >> For additional commands, e-mail: user-help@struts.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6486905
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6488051
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Question about session time-out using Listener

Posted by mosho <ro...@gmail.com>.
Thanks Tamas. That seems to get rid of the errors but it doesn't work. When
the session expires, it doesn't take me to any page, I tried forwarding to
struts actions and .jsp files, it doesn;t work for both. Any idea?

  <filter>
    <filter-name>SessionInactivityFilter</filter-name>
    <filter-class>javawebparts.filter.SessionInactivityFilter</filter-class>
    <init-param>
     <param-name>forwardTo</param-name>
     <param-value>/sessionError.do</param-value>
    </init-param>
  </filter> 


Tamas Szabo wrote:
> 
> Yes, you probably just added the filter at the end of the web.xml, after
> the
> <error-page> element that you already had in there.
> 
> You have to declare the elements in the order defined by the DTD.
> For 2.3 this is:
> 
> <!ELEMENT web-app (icon?, display-name?, description?, distributable?,
> context-param*, filter*, filter-mapping*, listener*, servlet*,
> servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
> error-page*, taglib*, resource-env-ref*, resource-ref*,
> security-constraint*,
> login-config?, security-role*, env-entry*, ejb-ref*,  ejb-local-ref*)>
> 
> So try to have the declaration of the filter and filter-mapping just
> before
> the listener elements or  the servlet element if you don't have any
> listeners declared.
> 
> Please don't hesitate to contact us if you have any other problems.
> 
> Tamas
> 
> 
> 
> 
> On 9/25/06, mosho <ro...@gmail.com> wrote:
>>
>>
>> Thanks for all your replies.
>> My application is a struts application. I tried to use
>> SessionInactivityFilter, i am getting compilation errors.
>> I just have to include the following in my xml file or I need to do
>> something else also:
>>
>> <filter>
>>   <filter-name>SessionInactivityFilter</filter-name>
>>  
>> <filter-class>javawebparts.filter.SessionInactivityFilter</filter-class>
>>   <init-param>
>>     <param-name>forwardTo</param-name>
>>     <param-value>/session_expired.jsp</param-value>
>>   </init-param>
>> </filter>
>>
>> I get the following error:
>> Error(108,9): Invalid element 'filter' in content of 'web-app', expected
>> elements '[taglib, resource-env-ref, resource-ref, security-constraint,
>> login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.
>>
>>
>> Tamas Szabo wrote:
>> >
>> > Hi,
>> >
>> > You can use SessionInactivityFilter from the JavaWebParts project if
>> you
>> > don't want to reinvent the wheel:
>> >
>> > Doc:
>> >
>> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
>> >
>> > JWP Home Page:
>> > http://javawebparts.sourceforge.net/
>> >
>> > Good Luck,
>> >
>> > Tamas
>> >
>> >
>> >
>> >
>> >
>> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
>> >
>> > On 9/25/06, mosho <ro...@gmail.com> wrote:
>> >>
>> >>
>> >>
>> >> Hi All,
>> >>
>> >> When session times out I want to forward a request to another
>> page.Isit
>> >> possible to do it with HttpSessionListener?
>> >> How can I get response object so that I can redirect to another page?
>> >>
>> >> Thanks for your  help!
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
>> >> Sent from the Struts - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6486905
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6488051
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Question about session time-out using Listener

Posted by Tamas Szabo <sz...@gmail.com>.
Yes, you probably just added the filter at the end of the web.xml, after the
<error-page> element that you already had in there.

You have to declare the elements in the order defined by the DTD.
For 2.3 this is:

<!ELEMENT web-app (icon?, display-name?, description?, distributable?,
context-param*, filter*, filter-mapping*, listener*, servlet*,
servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,
error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*,
login-config?, security-role*, env-entry*, ejb-ref*,  ejb-local-ref*)>

So try to have the declaration of the filter and filter-mapping just before
the listener elements or  the servlet element if you don't have any
listeners declared.

Please don't hesitate to contact us if you have any other problems.

Tamas




On 9/25/06, mosho <ro...@gmail.com> wrote:
>
>
> Thanks for all your replies.
> My application is a struts application. I tried to use
> SessionInactivityFilter, i am getting compilation errors.
> I just have to include the following in my xml file or I need to do
> something else also:
>
> <filter>
>   <filter-name>SessionInactivityFilter</filter-name>
>   <filter-class>javawebparts.filter.SessionInactivityFilter</filter-class>
>   <init-param>
>     <param-name>forwardTo</param-name>
>     <param-value>/session_expired.jsp</param-value>
>   </init-param>
> </filter>
>
> I get the following error:
> Error(108,9): Invalid element 'filter' in content of 'web-app', expected
> elements '[taglib, resource-env-ref, resource-ref, security-constraint,
> login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.
>
>
> Tamas Szabo wrote:
> >
> > Hi,
> >
> > You can use SessionInactivityFilter from the JavaWebParts project if you
> > don't want to reinvent the wheel:
> >
> > Doc:
> >
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> >
> > JWP Home Page:
> > http://javawebparts.sourceforge.net/
> >
> > Good Luck,
> >
> > Tamas
> >
> >
> >
> >
> >
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> >
> > On 9/25/06, mosho <ro...@gmail.com> wrote:
> >>
> >>
> >>
> >> Hi All,
> >>
> >> When session times out I want to forward a request to another page.Isit
> >> possible to do it with HttpSessionListener?
> >> How can I get response object so that I can redirect to another page?
> >>
> >> Thanks for your  help!
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6486905
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Question about session time-out using Listener

Posted by mosho <ro...@gmail.com>.
Thanks for all your replies.
My application is a struts application. I tried to use
SessionInactivityFilter, i am getting compilation errors.
I just have to include the following in my xml file or I need to do
something else also:

 <filter>
  <filter-name>SessionInactivityFilter</filter-name>
  <filter-class>javawebparts.filter.SessionInactivityFilter</filter-class>
  <init-param>
    <param-name>forwardTo</param-name>
    <param-value>/session_expired.jsp</param-value>
  </init-param>
</filter> 

I get the following error:
Error(108,9): Invalid element 'filter' in content of 'web-app', expected
elements '[taglib, resource-env-ref, resource-ref, security-constraint,
login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.


Tamas Szabo wrote:
> 
> Hi,
> 
> You can use SessionInactivityFilter from the JavaWebParts project if you
> don't want to reinvent the wheel:
> 
> Doc:
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> 
> JWP Home Page:
> http://javawebparts.sourceforge.net/
> 
> Good Luck,
> 
> Tamas
> 
> 
> 
> 
> http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html
> 
> On 9/25/06, mosho <ro...@gmail.com> wrote:
>>
>>
>>
>> Hi All,
>>
>> When session times out I want to forward a request to another page.Is it
>> possible to do it with HttpSessionListener?
>> How can I get response object so that I can redirect to another page?
>>
>> Thanks for your  help!
>> --
>> View this message in context:
>> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6486905
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Question about session time-out using Listener

Posted by Tamas Szabo <sz...@gmail.com>.
Hi,

You can use SessionInactivityFilter from the JavaWebParts project if you
don't want to reinvent the wheel:

Doc:
http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html

JWP Home Page:
http://javawebparts.sourceforge.net/

Good Luck,

Tamas




http://javawebparts.sourceforge.net/javadocs/javawebparts/filter/SessionInactivityFilter.html

On 9/25/06, mosho <ro...@gmail.com> wrote:
>
>
>
> Hi All,
>
> When session times out I want to forward a request to another page.Is it
> possible to do it with HttpSessionListener?
> How can I get response object so that I can redirect to another page?
>
> Thanks for your  help!
> --
> View this message in context:
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Question about session time-out using Listener

Posted by Li <am...@gmail.com>.
Simply you should:
1.
    a. create a tag handler "MyTagHandler" by extending "
javax.servlet.jsp.tagext.TagSupport"
    b.create two method : "doStartTag", "doEndTag"
    c. in "doEndtag(return type int)" you should get "HttpSession" object,
if you session object
        is not null,   return "(EVAL_PAGE)", otherwise create "ModuleConfig"
object by using:

------------------------------------------------------------------------------->>
      ModuleConfig config =
                (ModuleConfig) pageContext.getServletContext().getAttribute(
                    org.apache.struts.Globals.MODULE_KEY);

<<--------------------------------------------------------------------------
    d. do page forward using "pageContext.forward(<you page context path>)"

2. in your tag lib descriptor (mytag.tld), add the following codes:

------------------------------------------------------------------------------->>
   <tag>
    <name>checkLogin</name>
    <tagclass>your.path.to.taghandler.MyTagHandler</tagclass>
    <bodycontent>empty</bodycontent>
    ....
  </tag>
  (note: if you have attributes defined in your tag handler, add them into
within <tag> section)

2b. If you dont have your own tld, create one, see the struts site for
example, add the tag lib
      into web.xml

3. in all your protected jsp pages, add:
   <%@ taglib uri="/tags/mytag" prefix="mytag" %>
   <mytag:checkLogin/>


On 9/25/06, mosho <ro...@gmail.com> wrote:
>
>
> do you have any example to do this?
> Thanks.
>
> Li-3 wrote:
> >
> > you can create a taghandler, much simpler and flexible
> >
> > On 9/25/06, mosho <ro...@gmail.com> wrote:
> >>
> >>
> >>
> >> Hi All,
> >>
> >> When session times out I want to forward a request to another page.Isit
> >> possible to do it with HttpSessionListener?
> >> How can I get response object so that I can redirect to another page?
> >>
> >> Thanks for your  help!
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > When we invent time, we invent death.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480446
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
When we invent time, we invent death.

Re: Question about session time-out using Listener

Posted by mosho <ro...@gmail.com>.
do you have any example to do this?
Thanks.

Li-3 wrote:
> 
> you can create a taghandler, much simpler and flexible
> 
> On 9/25/06, mosho <ro...@gmail.com> wrote:
>>
>>
>>
>> Hi All,
>>
>> When session times out I want to forward a request to another page.Is it
>> possible to do it with HttpSessionListener?
>> How can I get response object so that I can redirect to another page?
>>
>> Thanks for your  help!
>> --
>> View this message in context:
>> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> When we invent time, we invent death.
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480446
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Question about session time-out using Listener

Posted by Li <am...@gmail.com>.
you can create a taghandler, much simpler and flexible

On 9/25/06, mosho <ro...@gmail.com> wrote:
>
>
>
> Hi All,
>
> When session times out I want to forward a request to another page.Is it
> possible to do it with HttpSessionListener?
> How can I get response object so that I can redirect to another page?
>
> Thanks for your  help!
> --
> View this message in context:
> http://www.nabble.com/Question-about-session-time-out-using-Listener-tf2329396.html#a6480246
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
When we invent time, we invent death.