Link to home
Start Free TrialLog in
Avatar of catz_120
catz_120

asked on

request.getParameter in a loop

I'm creating a matrix table with a lot of textboxes. The textboxes are named in a loop as follow:

<td><input type="text" name="<%=k%>-<%=i%>" size="6"></td>

When i passed the textbox values to the next page, I couldn't get the value of the textboxes (value = null).
Following is my script:

String[] result = new String[total];
String[] answer = new String[total];
int m=0;
int g=0;                                                                                      
for (int x=1; x <= counter; x++) {
    for (int y=1; y <= counter; y++) {                    
result[m] = x + "-" + y;
answer[m] =  request.getParameter("+result[m]+");
m++;
                                                                                                 
    }
}

Anything wrong with the loop?
ASKER CERTIFIED SOLUTION
Avatar of boonleng
boonleng
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Comp_Tekk
Comp_Tekk

Some clarification: the double quotes around +result[m]+ makes it a string = +result[m]+, not the value you were trying to reference in the array.

request.getParameter(""+result[m]+"") would have work but obviously is unnecessary.
>>request.getParameter(""+result[m]+"")

should be request.getParameter(""+result[m])

The other String concatenation is unnecessary
result[m] = x + "-" + y;
answer[m] =  request.getParameter("+result[m]+");

I am seeing it as a String so simply


answer[m] =  request.getParameter(result[m]) will work
This error message is displayed by the Microsoft Windows Installer engine and is a general error code that indicates a problem occurred during the installation. The following is a non-exhaustive list of known causes for this error:

    * Short file name creation is disabled on the target machine.

    * An InstallScript custom action is prototyped incorrectly.

    * A file is locked and cannot be overwritten.

    * The Microsoft Windows Installer Service is not installed correctly.

    * The Windows Temp folders are full.

    * The setup was corrupted after installation and, therefore, fails with this error during uninstallation.

    * An older version of InstallShield Developer is being used.

    * A general error occurred during the installation.

    * Print and File sharing is not installed or enabled when installing MSDE 2000.
oops wrong post

sorry
Avatar of catz_120

ASKER

thx for all the responses,  
request.getParameter(result[m]); does work