This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi. I've just finished "Struts 2 in Action" book, and I didn't find at any place wird about session tracking. Considering that Struts architecture is built upon Servlet API ( and on servlet we know that sesion tracking is preserved by cookies or url writing), I guess that framework by itself maintain such a tracking, isn't it?
And also I'm interesting where I place the tiles declaration file (tiles.xml) in the application (in the WEB-INF/classes, or ? ) ?
The reason you didn't find any information about session tracking in a Struts book is that session tracking is not done by Struts or any other web framwork. It's done by the application server (Tomcat, WebLogic, WebSphere, etc.). To understand how your application server does it, consult the relevant documentation.
Well, Servlets, also deployed on (let say) Tomcat, use mentioned mechanisms (cookies and URL rewriting) and it's specified by Servlet specification, right? I mean, it's not defined by server but Servlet spec.
Servers implement the Servlet spec. The server implements session tracking as defined by the spec.
Do you have a specific question about Struts and sessions?
The tiles definition files can go wherever you want as long as you define the location. I'd consider reading the Tiles documentation regarding configuration. Note also that Tiles 2 is no longer part of the Struts project.
Joined: Sep 26, 2008
Aha, Tiled are plugins, it's ok. Well about session tracking, just as I've asked, do I need to perform certain explicit method of session tracking (such as URL rewriting just as I did in pure Servlet based web application), do I need such a thing to perform in Action class (just as I did , or what?
According to the "using tags" docs, the <s:url...> tag will:
URL-encode the link with the Java session ID, if needed, so that the Java session can be retained across requests.
Joined: Sep 26, 2008
Well, I guess It will :-) But can I do that from Action like in Servlets where also in the sort of authentication servlet I should retrieve a session from request to start session tracking, or only in Struts, it could e done through the tag, if it is quite enough?