File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Submit form text fields (group) with same name!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Submit form text fields (group) with same name!!!" Watch "Submit form text fields (group) with same name!!!" New topic

Submit form text fields (group) with same name!!!

Moniphal Say
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
Hi all,
I am new to Structs,I've just use it last 2 weeks, now i found some problem which is simarly to Girish Varde posted last month(july 09, 2004 5:49 AM). My question is :
I want to display identical text fields in a form which should be as many as required, decided dynamically.
I use logic:iterate to iterate over my list of informations and I have put some input:text for each iterate.
How can I take a group of value of text fields with same name?

I've saw the reply of Marc Peabody and Srikanth Shenoy to Girish Varde, and I've try with that code but it still doesn't work.

Here is my code in the JSP page :

<% int counter=0; %>
<logic:iterate id="indexInfo" name="indexInfoList">
<c:when test="${indexInfo.dataType !='2'}">
Enter the string please :
<html:text indexed="true" property='<%= "indexValue[" + counter++ + "]" %>'/>
<c therwise>
Enter the number please :
<html:text indexed="true" property='<%= "indexValue[" + counter++ + "]" %>'/>
</c therwise>


And this is my action Form:

private String[] indexValue = new String[0];

public String[] getIndexValue() {
return indexValue;

public void setIndexValue(String[] strings) {
indexValue = strings;

But it is doesnt work since my JSP page.

The error message is :

java.lang.reflect.Array.get(Native Method)

So please help me to solve this problem !!!

It is sorta covered in the JavaRanch Style Guide.
subject: Submit form text fields (group) with same name!!!
It's not a secret anymore!