Solved

request.getParameter in a loop

Posted on 2004-09-09
7
375 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 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
Technology Partners: 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!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

691 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