How to send an Object using JSP

Hi there

I don’t whethar this question(related to JSP) should be ask here or not.
My Question is here is my form

Now question I am getting these send values using Name parameter in my servlet.But I am not able to differentiate between values that which value is related to which obect like Which Name of Organisation is related to which role and so on.

My Question is that can It possible to send values using Some types of bundle object from a JSP page to servlet(or any types of Server Side Script)?

Please ask if my question is not clear

In JSP you can receive array with values from each set of fields (name, role, from, etc)

Example:

HTML:

<input type="text" name="name" value="Company 1"/>
<input type="text" name="role" value="Role of Company 1"/>
<input type="text" name="name" value="Company 2"/>
<input type="text" name="role" value="Role of Company 2"/>

Java:

String[] names = request.getParameterValues("name");
String[] roles = request.getParameterValues("role");

so then you can iterate any of these arrays and get values from the other with the same index:

for (int i=0; i<names.length; i++){
    names[i]; /* name for current company */
    roles[i]; /* role for current company */
}

Thats what I was also thinking to get one index from one type of values and add them in an Array.

COOL!!!
will try it.
Is there any better solution then this.?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.