aspose file tools*
The moose likes Struts and the fly likes How to take dynamic values of textboxes to Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to take dynamic values of textboxes to Action class" Watch "How to take dynamic values of textboxes to Action class" New topic
Author

How to take dynamic values of textboxes to Action class

Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
Hi All,

In my page am having two dropdown on combination of two am getting results of 10 values.
Now I need to display the 10 values with 12 textboxes for each, i.e I will get 120 textboxes totally. Where user will fill the values and submit the page.

How to take these values to action page so that I can update the values in database?

And also like if already there is values for the 12 boxes for each element I need to display them by default.

Please give me a logic for this as am new to this.


Regards,
Kartik
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3859

Kartik Talasu wrote:In my page am having two dropdown on combination of two am getting results of 10 values.

Are you saying you have two select boxes each with five values or ... ?
Now I need to display the 10 values with 12 textboxes for each, i.e I will get 120 textboxes totally. Where user will fill the values and submit the page.

How to display 10 values in 12 text boxes?
How to take these values to action page so that I can update the values in database?

Are you working with any framework here?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
I mean to say like as am having two dropdown's ID and PLACE on change of both am accessing database and getting some results of 5 or 10 or 20 values or etc......

Suppose i choose ID as 1 and PLACE as India I will get results of 3 people names like A,B and C
so next to A i need to show 12 textboxes, again next to B i need to show 12 textboxes and next to C i need to show 12 textboxes.

And the user will fill some values in these 36 textboxes and submit the page.Now i need to read and save in DB. Am using STRUTS framework.


Regards,
Kartik
gaurav kant
Greenhorn

Joined: Oct 06, 2008
Posts: 14
gaurav kant
Greenhorn

Joined: Oct 06, 2008
Posts: 14
Here i am expecting that You have created text boxes as much as You need on page with the help of java script (if not then tell us, i will tell you ).
now put name Your test boxes say You have 3 text boxes
textBox1
textBox2
textBox3

put another hidden text box (say "allTextName") in which You will store comma separated string of name of all text boxes for example "allTextName" value will be "textBox1,textBox2,textBox3"
and while adding or deleting text boxes, update "allTextName".
Now in Your action class, simply get
request.getParameter("allTextName") and tokanize it through ",". at this point You have all the names of textboxes just put in request.getParameter() and fetch the values

Hope it will work
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
You can use struts indexed properties for the dynamic values.

May the following link will be useful for you
Struts indexed properties
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to take dynamic values of textboxes to Action class