Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-474

Ability to dynamically create array of Objects from a given request

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • WW 2.1
    • WW 2.1
    • Core Interceptors
    • None
    • Windows XP, Tomcat 5.0.16, JDK 1.4.1_03

    Description

      First, Kudos to team for creating a very simple yet powerful framework.

      I have a situation where I would like to receive an unknown no. of user names from a web page. Using DHTML I am dynamically creating text fields as user[0], user[1]....

      My FormAction.java looks like following

      public class FormAction extends ActionSupport {
      private String[] users = null;
      public String[] getUsers()

      { return users; }

      public void setUsers(String[] value)

      { this.users = value; }

      public String processForm()

      { return SUCCESS; }

      }

      However, on submitting the action request, I get
      java.lang.InstantiationException: [Ljava.lang.String; error. Even if I initialize the String array, it still does not work.

      Not sure if this is a bug or a new feature request. Hence I have reported as a bug.

      Would be great to instatiate dynmically unknow no. of object as array in this way.

      Thanks in advance

      Attachments

        Activity

          People

            Unassigned Unassigned
            bhavinkamani Bhavin Kamani
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: