File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get data from a set of textfields?

 
Akshay Kumar
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, here, in my application, i'm displaying rows of textfields(the count of textfields is dynamic) in a jsp and i need to get the values from each of these fields.

straight to the point, for the number of textfields it generates possess the same name "quantity" in the interpreted HTML code. hence, i culdn't get value(what user enters) from a particular textfield.

infact, i tried out using "quantity<%= index%>" to distinguish each of textfields. but, since it is a dynamic thing, i culd not figure out as many getter and setter methods in its corresponding form.



how, to resolve this logic. any efforts towards here wuld b appreciated.
thanks.
 
M Murthy
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same question a few days back and i found the below article very helpful

http://www.developer.com/java/web/article.php/2233591

In your case POLine.java will be your Product.java with quantoty as its member. Just define form-bean and action-mapping as in the article and you will be good to go.
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved it like this.
I had a hidden field and it was included as a form bean attribute. Before submitting the form, I'll collect the values of dynamic textfields and make it a comma separated list and assign it to the hidden field with the help of JavaScript.

In the form bean, this will be a comma separated string and the action class can split it and use the values. This is simple and it works.

hth,
Sudharsan
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic