Problem with get ParameterValues function

Hi all (again!),

I have two jsp files (a.jsp, b.jsp). In a.jsp i have the following code:

for (int i = 0, i < rows; i++){

out.print("<tr>");

out.print("<td><form><input type=checkbox name=checkbox value=checkbox onClick=enableTxtField("+j+")></form></td>");

out.print("<td><div align=center>"+products[i][0]+"</div></td>");

out.print("<td><div align=center>"+products[i][1]+"</div></td>");

out.print("<td><div align=center>"+products[i][3]+"</div></td>");

out.print("<td><div align=center>"+products[i][2]+"</div></td>");

out.print("<td><div align=center>"+products[i][4]+"</div></td>");

out.print("<td><form><div align=center><input type=\"text\" name=\"textfield\" disabled></div></form></td>");

out.print("</tr>");

}

then i want in b.jsp to retrieve the values of all textfields.

I tried using get parameter values like:

[code]

String[] passname;

passname = request.getParameterValues("param");

if (passname==null) out.print("hahaha");

else out.print(passname.length);

but i always get passname to null.

Can anyone tell me why this is happening.

[2032 byte] By [PirateManiaca] at [2007-11-26 16:27:17]
# 1

Hi! int thextfield tag you have name=\"textfield\"

in b.jsp you have request.getParameterValues("param");

but in a.jsp file you don't have parameter name "param", for getting the textfield value you need to use request.getParameterValues("textfield");

but your textfield tag is disabled and have no value, you will gon empty String.

Ori-Gila at 2007-7-8 22:51:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Well thanks for the reply.

I have made an error (copy paste error). I have changed my original post. I have the same value requested and set in both a and b.jsp.

This doesn't work as you said because my textfield are disable.

however before post my form, i have a javascript function that enables the textfield when the coresponding checkbox is checked. So why am i still getting null when i have given input?

I repost my correct code here:

for (int i = 0, i < rows; i++) {

out.print("<tr>");

out.print("<td><form><input type=checkbox name=checkbox value=checkbox onClick=enableTxtField("+j+")></form></td>");

out.print("<td><div align=center>"+products[i][0]+"</div></td>");

out.print("<td><div align=center>"+products[i][1]+"</div></td>");

out.print("<td><div align=center>"+products[i][3]+"</div></td>");

out.print("<td><div align=center>"+products[i][2]+"</div></td>");

out.print("<td><div align=center>"+products[i][4]+"</div></td>");

out.print("<td><form><div align=center><input type=\"text\" name=\"textfield\" disabled></div></form></td>");

out.print("</tr>");

}

String[] passname;

passname = request.getParameterValues("textfield");

if (passname==null) out.print("hahaha");

else out.print(passname.length);

PirateManiaca at 2007-7-8 22:51:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...