RE: Session Times Out
Hello everybody: How best is i18N taglib useful, along with struts 1.1 - Vara Prasad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session Times Out
I use a servlet filter - this way I can restrict access to actions & JSPs without putting any code in either of them. Paul -Original Message- From: Seyhan BASMACI (Internet Yazilimlari Yetkilisi) [mailto:[EMAIL PROTECTED] Sent: 03 November 2003 10:20 To: Struts Users Mailing List Subject: RE: Session Times Out I think best way to check session is to extend requestProcessor Class and override processPath method, -Original Message- From: Jose Ramon Diaz [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 12:06 PM To: 'Struts Users Mailing List' Subject: RE: Session Times Out Hi, But be carefull because the actions will be executed before redirecting to JSP, so I think it?s better to check the session in all the actions, isn?t it? > > Make a custom tag like so : > > > > Create a tld file with this in it : > > > Tag Library > 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";> > > 1.0 > 1.1 > Tag Libs > ustom Tags > > checkLogin > > com.cpaglobal.cpadirect.tag.CheckLogin > empty > Checks the login status of a user and > forward them to the > login page if not logged in. > > loginPage > false > false > > > default > false > false > > > > > > > Code for the custom tag : > > package com.cpaglobal.cpadirect.tag; > > import java.io.IOException; > > import javax.servlet.ServletException; > import javax.servlet.http.HttpSession; > import javax.servlet.jsp.JspException; > import javax.servlet.jsp.tagext.TagSupport; > > import com.cpaglobal.cpadirect.applicationlogic.SessionVariables; > import com.cpaglobal.cpadirect.applicationlogic.User; > > > public class CheckLogin extends TagSupport { > > > private String loginPage = "/JSP/Timeout.jsp"; > > > public void setLoginPage(String loginPage) { > this.loginPage = loginPage; > } > > public int doStartTag() throws JspException { > return (SKIP_BODY); > } > > public int doEndTag() { > try { > HttpSession session = pageContext.getSession(); > if (session != null) { > User user = (User) > session.getAttribute(SessionVariables.SESSION_LOGGED_ON_USER); > if (user == null) { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } else { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } catch(ServletException e) { > new JspException(e.toString()); > } catch(IOException e) { > new JspException(e.toString()); > } > return (EVAL_PAGE); > } > > } > > How to use it : > > <%@ taglib uri="/WEB-INF/cpa.tld" prefix="cpa"%> > > > Mike > > > > > |-+> > | | Caroline Jen | > | | <[EMAIL PROTECTED]| > | | .com>| > | || > | | 03/11/2003 06:23 | > | | AM | > | | Please respond to| > | | "Struts Users| > | | Mailing List"| > |-+> > > >--------- > -| > | >| > | To: [EMAIL PROTECTED] > | > | cc: >| > | Subject: Session Times Out >| > > >- > -| > > > > > I check if session expires for each action in the > application. If the session times out, I forward the > user to index.jsp so that the user can log on again. > > How do I inform the user with a message that he/she is > at t
RE: Session Times Out
Or even better, use a filter (which requires Servlet API 2.3 or greater) -Original Message- From: Seyhan BASMACI (Internet Yazilimlari Yetkilisi) [mailto:[EMAIL PROTECTED] Sent: Monday, 3 November 2003 18:20 To: Struts Users Mailing List Subject: RE: Session Times Out I think best way to check session is to extend requestProcessor Class and override processPath method, -Original Message- From: Jose Ramon Diaz [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 12:06 PM To: 'Struts Users Mailing List' Subject: RE: Session Times Out Hi, But be carefull because the actions will be executed before redirecting to JSP, so I think it?s better to check the session in all the actions, isn?t it? > > Make a custom tag like so : > > > > Create a tld file with this in it : > > > Tag Library > 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";> > > 1.0 > 1.1 > Tag Libs > ustom Tags > > checkLogin > > com.cpaglobal.cpadirect.tag.CheckLogin > empty > Checks the login status of a user and > forward them to the > login page if not logged in. > > loginPage > false > false > > > default > false > false > > > > > > > Code for the custom tag : > > package com.cpaglobal.cpadirect.tag; > > import java.io.IOException; > > import javax.servlet.ServletException; > import javax.servlet.http.HttpSession; > import javax.servlet.jsp.JspException; > import javax.servlet.jsp.tagext.TagSupport; > > import com.cpaglobal.cpadirect.applicationlogic.SessionVariables; > import com.cpaglobal.cpadirect.applicationlogic.User; > > > public class CheckLogin extends TagSupport { > > > private String loginPage = "/JSP/Timeout.jsp"; > > > public void setLoginPage(String loginPage) { > this.loginPage = loginPage; > } > > public int doStartTag() throws JspException { > return (SKIP_BODY); > } > > public int doEndTag() { > try { > HttpSession session = pageContext.getSession(); > if (session != null) { > User user = (User) > session.getAttribute(SessionVariables.SESSION_LOGGED_ON_USER); > if (user == null) { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } else { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } catch(ServletException e) { > new JspException(e.toString()); > } catch(IOException e) { > new JspException(e.toString()); > } > return (EVAL_PAGE); > } > > } > > How to use it : > > <%@ taglib uri="/WEB-INF/cpa.tld" prefix="cpa"%> > > > Mike > > > > > |-+> > | | Caroline Jen | > | | <[EMAIL PROTECTED]| > | | .com>| > | || > | | 03/11/2003 06:23 | > | | AM | > | | Please respond to| > | | "Struts Users| > | | Mailing List"| > |-+> > > >--------- > -| > | >| > | To: [EMAIL PROTECTED] > | > | cc: >| > | Subject: Session Times Out >| > > >- > -| > > > > > I check if session expires for each action in the > application. If the session times out, I forward the > user to index.jsp so that the user can log on again. > > How do I inform the user with a message that he/she is > at the welcome page because the session has expired?
RE: Session Times Out
Yeah, you would do it in both places. In the jsp when you access it directly, and in the action. Mike |-+> | | "Jose Ramon Diaz"| | | <[EMAIL PROTECTED]| | | di.es> | | || | | 03/11/2003 10:06 | | | AM | | | Please respond to| | | "Struts Users| | | Mailing List"| |-+> >--| | | | To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> | | cc: | | Subject: RE: Session Times Out | >--| Hi, But be carefull because the actions will be executed before redirecting to JSP, so I think it?s better to check the session in all the actions, isn?t it? > > Make a custom tag like so : > > > > Create a tld file with this in it : > > > Tag Library > 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";> > > 1.0 > 1.1 > Tag Libs > ustom Tags > > checkLogin > > com.cpaglobal.cpadirect.tag.CheckLogin > empty > Checks the login status of a user and > forward them to the > login page if not logged in. > > loginPage > false > false > > > default > false > false > > > > > > > Code for the custom tag : > > package com.cpaglobal.cpadirect.tag; > > import java.io.IOException; > > import javax.servlet.ServletException; > import javax.servlet.http.HttpSession; > import javax.servlet.jsp.JspException; > import javax.servlet.jsp.tagext.TagSupport; > > import com.cpaglobal.cpadirect.applicationlogic.SessionVariables; > import com.cpaglobal.cpadirect.applicationlogic.User; > > > public class CheckLogin extends TagSupport { > > > private String loginPage = "/JSP/Timeout.jsp"; > > > public void setLoginPage(String loginPage) { > this.loginPage = loginPage; > } > > public int doStartTag() throws JspException { > return (SKIP_BODY); > } > > public int doEndTag() { > try { > HttpSession session = pageContext.getSession(); > if (session != null) { > User user = (User) > session.getAttribute(SessionVariables.SESSION_LOGGED_ON_USER); > if (user == null) { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } else { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } catch(ServletException e) { > new JspException(e.toString()); > } catch(IOException e) { > new JspException(e.toString()); > } > return (EVAL_PAGE); > } > > } > > How to use it : > > <%@ taglib uri="/WEB-INF/cpa.tld" prefix="cpa"%> > > > Mike > > > > > |-+> > | | Caroline Jen | > | | <[EMAIL PROTECTED]| > | | .com>| > | || > | | 03/11/2003 06:23 | > | | AM | > | | Please respond to| > | | "Struts Users| > | | Mailing List"| > |-----+-------
RE: Session Times Out
I think best way to check session is to extend requestProcessor Class and override processPath method, -Original Message- From: Jose Ramon Diaz [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 12:06 PM To: 'Struts Users Mailing List' Subject: RE: Session Times Out Hi, But be carefull because the actions will be executed before redirecting to JSP, so I think it?s better to check the session in all the actions, isn?t it? > > Make a custom tag like so : > > > > Create a tld file with this in it : > > > Tag Library > 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";> > > 1.0 > 1.1 > Tag Libs > ustom Tags > > checkLogin > > com.cpaglobal.cpadirect.tag.CheckLogin > empty > Checks the login status of a user and > forward them to the > login page if not logged in. > > loginPage > false > false > > > default > false > false > > > > > > > Code for the custom tag : > > package com.cpaglobal.cpadirect.tag; > > import java.io.IOException; > > import javax.servlet.ServletException; > import javax.servlet.http.HttpSession; > import javax.servlet.jsp.JspException; > import javax.servlet.jsp.tagext.TagSupport; > > import com.cpaglobal.cpadirect.applicationlogic.SessionVariables; > import com.cpaglobal.cpadirect.applicationlogic.User; > > > public class CheckLogin extends TagSupport { > > > private String loginPage = "/JSP/Timeout.jsp"; > > > public void setLoginPage(String loginPage) { > this.loginPage = loginPage; > } > > public int doStartTag() throws JspException { > return (SKIP_BODY); > } > > public int doEndTag() { > try { > HttpSession session = pageContext.getSession(); > if (session != null) { > User user = (User) > session.getAttribute(SessionVariables.SESSION_LOGGED_ON_USER); > if (user == null) { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } else { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } catch(ServletException e) { > new JspException(e.toString()); > } catch(IOException e) { > new JspException(e.toString()); > } > return (EVAL_PAGE); > } > > } > > How to use it : > > <%@ taglib uri="/WEB-INF/cpa.tld" prefix="cpa"%> > > > Mike > > > > > |-+> > | | Caroline Jen | > | | <[EMAIL PROTECTED]| > | | .com>| > | || > | | 03/11/2003 06:23 | > | | AM | > | | Please respond to| > | | "Struts Users| > | | Mailing List"| > |-+> > > >--------- > -| > | >| > | To: [EMAIL PROTECTED] > | > | cc: >| > | Subject: Session Times Out >| > > >- > -| > > > > > I check if session expires for each action in the > application. If the session times out, I forward the > user to index.jsp so that the user can log on again. > > How do I inform the user with a message that he/she is > at the welcome page because the session has expired? > > __ > Do you Yahoo!? > Exclusive Video Premiere - Britney Spears > http://launch.yahoo.com/promos/britneyspears/ > > - > To unsubscribe, e-mail: [E
Re: Session Times Out
hi, you can inform the user by using the request object bind ur message by : request.setAttribute("messageName", "session timed out!!"); retrieve the message by : request.getAttribute("messageName"); hope this helps u. regards, Vinayak. - Original Message - From: "Caroline Jen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 03, 2003 11:53 AM Subject: Session Times Out > I check if session expires for each action in the > application. If the session times out, I forward the > user to index.jsp so that the user can log on again. > > How do I inform the user with a message that he/she is > at the welcome page because the session has expired? > > __ > Do you Yahoo!? > Exclusive Video Premiere - Britney Spears > http://launch.yahoo.com/promos/britneyspears/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session Times Out
Hi, But be carefull because the actions will be executed before redirecting to JSP, so I think it?s better to check the session in all the actions, isn?t it? > > Make a custom tag like so : > > > > Create a tld file with this in it : > > > Tag Library > 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";> > > 1.0 > 1.1 > Tag Libs > ustom Tags > > checkLogin > > com.cpaglobal.cpadirect.tag.CheckLogin > empty > Checks the login status of a user and > forward them to the > login page if not logged in. > > loginPage > false > false > > > default > false > false > > > > > > > Code for the custom tag : > > package com.cpaglobal.cpadirect.tag; > > import java.io.IOException; > > import javax.servlet.ServletException; > import javax.servlet.http.HttpSession; > import javax.servlet.jsp.JspException; > import javax.servlet.jsp.tagext.TagSupport; > > import com.cpaglobal.cpadirect.applicationlogic.SessionVariables; > import com.cpaglobal.cpadirect.applicationlogic.User; > > > public class CheckLogin extends TagSupport { > > > private String loginPage = "/JSP/Timeout.jsp"; > > > public void setLoginPage(String loginPage) { > this.loginPage = loginPage; > } > > public int doStartTag() throws JspException { > return (SKIP_BODY); > } > > public int doEndTag() { > try { > HttpSession session = pageContext.getSession(); > if (session != null) { > User user = (User) > session.getAttribute(SessionVariables.SESSION_LOGGED_ON_USER); > if (user == null) { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } else { > pageContext.forward(loginPage); > return (SKIP_PAGE); > } > } catch(ServletException e) { > new JspException(e.toString()); > } catch(IOException e) { > new JspException(e.toString()); > } > return (EVAL_PAGE); > } > > } > > How to use it : > > <%@ taglib uri="/WEB-INF/cpa.tld" prefix="cpa"%> > > > Mike > > > > > |-+> > | | Caroline Jen | > | | <[EMAIL PROTECTED]| > | | .com>| > | || > | | 03/11/2003 06:23 | > | | AM | > | | Please respond to| > | | "Struts Users| > | | Mailing List"| > |-+> > > >------------- > -| > | >| > | To: [EMAIL PROTECTED] > | > | cc: >| > | Subject: Session Times Out >| > > >- > -| > > > > > I check if session expires for each action in the > application. If the session times out, I forward the > user to index.jsp so that the user can log on again. > > How do I inform the user with a message that he/she is > at the welcome page because the session has expired? > > __ > Do you Yahoo!? > Exclusive Video Premiere - Britney Spears > http://launch.yahoo.com/promos/britneyspears/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > ** > ** > The info
Re: Session Times Out
Make a custom tag like so : Create a tld file with this in it : http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";> 1.0 1.1 Tag Libs ustom Tags checkLogin com.cpaglobal.cpadirect.tag.CheckLogin empty Checks the login status of a user and forward them to the login page if not logged in. loginPage false false default false false Code for the custom tag : package com.cpaglobal.cpadirect.tag; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpSession; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.TagSupport; import com.cpaglobal.cpadirect.applicationlogic.SessionVariables; import com.cpaglobal.cpadirect.applicationlogic.User; public class CheckLogin extends TagSupport { private String loginPage = "/JSP/Timeout.jsp"; public void setLoginPage(String loginPage) { this.loginPage = loginPage; } public int doStartTag() throws JspException { return (SKIP_BODY); } public int doEndTag() { try { HttpSession session = pageContext.getSession(); if (session != null) { User user = (User) session.getAttribute(SessionVariables.SESSION_LOGGED_ON_USER); if (user == null) { pageContext.forward(loginPage); return (SKIP_PAGE); } } else { pageContext.forward(loginPage); return (SKIP_PAGE); } } catch(ServletException e) { new JspException(e.toString()); } catch(IOException e) { new JspException(e.toString()); } return (EVAL_PAGE); } } How to use it : <%@ taglib uri="/WEB-INF/cpa.tld" prefix="cpa"%> Mike |-+> | | Caroline Jen | | | <[EMAIL PROTECTED]| | | .com>| | || | | 03/11/2003 06:23 | | | AM | | | Please respond to| | | "Struts Users| | | Mailing List"| |-+> >--| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: Session Times Out | >--| I check if session expires for each action in the application. If the session times out, I forward the user to index.jsp so that the user can log on again. How do I inform the user with a message that he/she is at the welcome page because the session has expired? __ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information in this message is confidential and may be legally privileged. It is intended solely for the addressee; access to this email by anyone else is unauthorised. If you are not the intended recipient: (1) you are kindly requested to return a copy of this message to the sender indicating that you have received it in error, and to destroy the received copy; and (2) any disclosure or distribution of this message, as well as any action taken or omitted to be taken in reliance on its content, is prohibited and may be unlawful. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session Times Out
test
RE: Session Times Out
if session becomes null than try this if ( session.getValue("SESSIONNAME")==null ){%> window.open("Index.jsp",fullscreen="yes"); parent.close(); //winself = window.self; //winself.setTimeout("window.close()",1); <% } try this and than U can set one more attritbute(Flag) which on the Index page can show a message that the user is here because of timeout. Regards, Amit Kumar Sharma SysArris Software Pvt Ltd 120A, Elephant Rock Road, 3rd Block, Jayanagar,Bangalore - 560011 Tel.: 91-80-665 4965 / 665 5052 [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 11:54 AM To: [EMAIL PROTECTED] Subject: Session Times Out I check if session expires for each action in the application. If the session times out, I forward the user to index.jsp so that the user can log on again. How do I inform the user with a message that he/she is at the welcome page because the session has expired? __ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session Times Out
if session becomes null than try this if ( session.getValue("SESSIONNAME")==null ){%> window.open("Index.jsp",fullscreen="yes"); parent.close(); //winself = window.self; //winself.setTimeout("window.close()",1); <% } try this and than U can set one more attritbute(Flag) which on the Index page can show a message that the user is here because of timeout. Regards, Amit Kumar Sharma SysArris Software Pvt Ltd 120A, Elephant Rock Road, 3rd Block, Jayanagar,Bangalore - 560011 Tel.: 91-80-665 4965 / 665 5052 [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, November 03, 2003 11:54 AM To: [EMAIL PROTECTED] Subject: Session Times Out I check if session expires for each action in the application. If the session times out, I forward the user to index.jsp so that the user can log on again. How do I inform the user with a message that he/she is at the welcome page because the session has expired? __ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session Times Out
I check if session expires for each action in the application. If the session times out, I forward the user to index.jsp so that the user can log on again. How do I inform the user with a message that he/she is at the welcome page because the session has expired? __ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]