Solved

request.getParameter in a loop

Posted on 2004-09-09
7
313 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
Comment Utility
should be request.getParameter(result[m]);
0
 
LVL 1

Expert Comment

by:Comp_Tekk
Comment Utility
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
Comment Utility
>>request.getParameter(""+result[m]+"")

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

The other String concatenation is unnecessary
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 14

Expert Comment

by:sudhakar_koundinya
Comment Utility
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
Comment Utility
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
Comment Utility
oops wrong post

sorry
0
 

Author Comment

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now