Hello there, I am facing a problem for getting values from a vector(using DynaForm), which contains objects having setter/getter method. Suppose a Vector v is having objects of a class login, which has username and password's setter/getter method. I create those empty objects and store that in vector. On other side,in JSP,I define a textfield named as v.login.username OR v.login.password. Later in action class,if I iterate through Vector v and get hold of object login, I am not able to get values of username/password in action class, using login.getUsername() OR login.getPassword. Any suggestion, is highly appreciated. Thanks, Abra
posted 10 years ago
In your JSP, you must define the name of the text field as v.login.username, v.login.password or v.login.username, etc. Since there could be any number of login objects in the vector, you have to specify which one you're updating. If you want the jsp to display all the Login objects in the vector and don't know how many there are, use either the <logic:iterate> or <c:forEarch> tags to iterate over the collection.