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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- When we invent time, we invent death.