?
Solved

request.getParameter in a loop

Posted on 2004-09-09
7
Medium Priority
?
395 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 14

Accepted Solution

by:
boonleng earned 100 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

770 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