tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vernon <vwu...@yahoo.com>
Subject Re: Session Attribute Management
Date Thu, 29 Sep 2005 00:28:13 GMT

I already found the problem. It is about how a request
shall be written in a JSP file: using <c:url
value="myRequest.html">.

Thanks

--- Vernon <vwu725@yahoo.com> wrote:

> Hi, all,
> 
> In my application, a session attribute is needed to
> let the application function properly. So, I have a
> filter to verify whether this attribute is set or
> not
> in the session. 
> 
> The doFilter method of the filter is something like
> the following:
> 
> 	public void doFilter(ServletRequest request,
> ServletResponse response,
> 			FilterChain chain) throws IOException,
> ServletException {
> 
> 		HttpServletRequest hreq = (HttpServletRequest)
> request;
> 		logger.debug("Enter: " + hreq.getRequestURL());
> 		if (request instanceof HttpServletRequest) {
> 			logger.debug("instanceof");
> 			HttpSession session = hreq.getSession(false);
> 			// Check the session setting
> 			if (session != null) {
> 				logger.debug("session");
> 				if (session.getAttribute("myAttr") != null) {
> 					logger.debug("Attr set");
> 					// jump to the resource if it is set
> 					chain.doFilter(request, response);
> 					return;
> 				}
> 			}
> 		}
>                         
> 	// ....
> 			
>
filterConfig.getServletContext().getRequestDispatcher(
> 						"/" + the_page).forward(request, response);
> 				return;
> 
> 	}
> }
> 
> After having an additonal segment of the application
> up, I find the the getSession(false) returns null
> for
> the requests of the first segment of application.
> When
> I click the first segment of the application, I am
> forwarded to the "the_page", while I reach the right
> page on the second segment. There is not any
> architecture difference between these two segments.
> 
> I use the Spring framework by the way. I don't think
> the framework has anything to do with the session
> management.
> 
> What is the cause?
> 
> Thanks very much for all your inputs in advance.
> 
> Vernon
> 
> 
> 
> 
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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


Mime
View raw message