tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vernon <>
Subject Session Attribute Management
Date Wed, 28 Sep 2005 20:38:19 GMT
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)
		logger.debug("Enter: " + hreq.getRequestURL());
		if (request instanceof HttpServletRequest) {
			HttpSession session = hreq.getSession(false);
			// Check the session setting
			if (session != null) {
				if (session.getAttribute("myAttr") != null) {
					logger.debug("Attr set");
					// jump to the resource if it is set
					chain.doFilter(request, response);
	// ....
						"/" + the_page).forward(request, response);


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

What is the cause?

Thanks very much for all your inputs in advance.


Yahoo! Mail - PC Magazine Editors' Choice 2005

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message