It's not a secret anymore!
The moose likes JBoss/WildFly and the fly likes Using kookies in JBoss-4.0.0RC2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Using kookies in JBoss-4.0.0RC2" Watch "Using kookies in JBoss-4.0.0RC2" New topic

Using kookies in JBoss-4.0.0RC2

Seji Thomas

Joined: Oct 31, 2004
Posts: 6
Using Kookies in JBoss-4.0.0RC2

From a form-login-page I want to pass additional information other than the j_username, and j_password. For this I have a drop-down list on my form-login-page from which the user can select an appropriate value. Before the submit to the /j_security_check action, I call a javascript function which sets the document Kookie with user selected value. Sample code is as below

function setKookie() {

var locale_key = "localeKey";
//build the Kookies
var path = "/";
var localeKookie = locale_key + "=" + escape(document.loginForm.localeKey.value) + ((path) ? "; path=" + path : "");

//Set the Kookies

document.Kookie = localeKookie;

return true;

After the /j_security_check action (I am using JAAS authentication for login) a struts action class is called, where I try to retrieve this set Kookie from the request object. I am using this locale information derived from the Kookie in my application.

Now the problem which I encounter is I am not getting the expected Kookie from the request. But occassionally I am able to retrieve it. When it happens so then I am able to navigate to my application with out problems. Other wise it gives me problem. The Jboss version I am using is 4.0.0RC2

Is this way of passing additional information appropriate in JBoss? If not what is the way to send additional information from the form-login-page?
Jeff Shelley
Ranch Hand

Joined: May 21, 2003
Posts: 70
I don't know why that wouldn't work. I've had problems in the past with double submitting. could it be related to that?

It's almost Friday
It is sorta covered in the JavaRanch Style Guide.
subject: Using kookies in JBoss-4.0.0RC2
jQuery in Action, 3rd edition