JSP problem:request object returning null

Hello,

I am using an authorization JSP before proceeding to another JSP. When the authorization is valid, I go to the next JSP. Now there is a drop down box in this next JSP. I select a value from this drop down and submit the form. When I retrieve the value of this drop down in the next JSP using request.getParameter(), it returns null. The problem is, when I don't use the authorization JSP and proceed directly to the next JSP, and select a value from the drop down, and go to the next JSP, the request.getParameter() returns the valid value.

In the authorization JSP, I am using the following code, may be there's the bug.

String auth = request.getHeader("Authorization");

if (auth == null) {

response.setStatus(response.SC_UNAUTHORIZED);

response.setHeader("WWW-Authenticate", "NTLM");

return;

}

if (auth.startsWith("NTLM ")) {

byte[] msg =

new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));

int off = 0, length, offset;

if (msg[8] == 1) {

off = 18;

byte z = 0;

byte[] msg1 =

{(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',

(byte)'S', (byte)'P', z,

(byte)2, z, z, z, z, z, z, z,

(byte)40, z, z, z, (byte)1, (byte)130, z, z,

z, (byte)2, (byte)2, (byte)2, z, z, z, z, //

z, z, z, z, z, z, z, z};

//

response.setStatus(response.SC_UNAUTHORIZED);

response.setHeader("WWW-Authenticate", "NTLM "

+ new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());

return;

}

else if (msg[8] == 3) {

off = 30;

length = msg[off+17]*256 + msg[off+16];

offset = msg[off+19]*256 + msg[off+18];

s = new String(msg, offset, length);

//out.println(s + " ");

}

else

return;

length = msg[off+1]*256 + msg[off];

offset = msg[off+3]*256 + msg[off+2];

s = new String(msg, offset, length);

//out.println(s + " ");

length = msg[off+9]*256 + msg[off+8];

offset = msg[off+11]*256 + msg[off+10];

s = new String(msg, offset, length);

s1=s.toString().trim();

// Our Logic starts here now that we have the login user name

char[] temp = s1.toCharArray();

char[] user_char= temp;

String userName = "";

int j=0;

for(int i=0;i<s1.length();i++){

if((int)temp!=0){

user_char[j]=temp;

j++;

}

}

Please help.>

[2457 byte] By [yuva670a] at [2007-11-27 11:03:26]
# 1

I dont know. However, since I doubt anyone on the forums worked with this authorization scheme and is therefore unlikely to answer, here is my two cents worth.

On your second JSP page, print out the names of all items in request scope and see what names are there (specifically look for the ones your looking for).

Example:

interate over and print out something like this (this isn't the correct function name, but you get the idea):

enum names1= request.getAllParameterNames();

Then also

enum names2= request.getAllAttributeNames();

You can also iterate over and print out the value for each of those names. Something like:

String value=

request.getParameterValue("someName");

George123a at 2007-7-29 12:49:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

How is this authorization check triggered? Is it in every JSP page? Are you using a servlet filter / controller?

How do you transfer control from one page to another. Is it done using RequestDispatcher, or response.sendRedirect() or something else?

evnafetsa at 2007-7-29 12:49:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...