Solved

request.getParameter in a loop

Posted on 2004-09-09
7
334 Views
Last Modified: 2008-02-01
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?
0
Comment
Question by:catz_120
7 Comments
 
LVL 14

Accepted Solution

by:
boonleng earned 25 total points
ID: 12023686
should be request.getParameter(result[m]);
0
 
LVL 1

Expert Comment

by:Comp_Tekk
ID: 12023986
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.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12024773
>>request.getParameter(""+result[m]+"")

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

The other String concatenation is unnecessary
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12024778
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
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12024809
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.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12024816
oops wrong post

sorry
0
 

Author Comment

by:catz_120
ID: 12024834
thx for all the responses,  
request.getParameter(result[m]); does work
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 89
groupSumClump challenge 9 115
servlet doXXX methods 3 49
tomcat startup error 5 65
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question