This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes jsessionid and session tracking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "jsessionid and session tracking" Watch "jsessionid and session tracking" New topic
Author

jsessionid and session tracking

Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
I use struts frame work. And I use HttpSession for session tracking. When I deploy and test in my test environment (WSAD and WebSphere application server), I don�t see jsessionid attached to the url. Is this the case always? Also I don�t see the data I submit in the url. Does this mean that the default method used in struts is �post� not �get�? I am still learning struts and jsp. Can somebody please give me some information?
Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61456
    
  67

"alexgeorge georgeAlex",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
Sir, I tried with my real name when I registered. But it wouldn't let me proceed without changing the name. So I had to change it the way it is now.
[ March 24, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61456
    
  67

I do believe that the struts form tag defaults to creating an html form tag with a method of "post" but it's been a long time since I've used Struts. To be sure, I've moved this post to the Struts forum where questions on Struts and its tags are discussed.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Bear is right. If you use the <html:form /> tag in your JSP, the default method is post instead of get. Aslo, regarding your JSessionId question: Since your development environment is WSAD, the test server you are using is IBM's WebSphere Application Server (WAS). The default configuration for WAS is to use cookies only for tracking sessions. If you want sessions to be tracked via URL rewriting, you must change the configuration of WAS to do so. Once you do this, you will begin to see JSessionID attached to your URLs.


Merrill
Consultant, Sima Solutions
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
Thank you.
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
May be this sounds like a stupid question. But let me ask this anyway. If I use HttpSession for session tracking, does WAS use cookies for session tracking?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Under the covers, Httpsession tracking uses cookies or falls back on URL rewriting(if neccessary) to handle sessions. This is nothing you need to worry about, unless your users browser will not have cookies enabled. In that case, you have to make sure your code uses URL rewriting if to encode any URLs you generate.

Originally posted by Alex George:
May be this sounds like a stupid question. But let me ask this anyway. If I use HttpSession for session tracking, does WAS use cookies for session tracking?


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
Don't get me started about those stupid light bulbs.
 
subject: jsessionid and session tracking