appari
asked on
Struts and dynamic controls/control array
I am new to struts framework.
the working environment is windows + IIS + Tomcat 5 + Struts 1.1
the problem is i need to develop a jsp page using struts framework and the view is something like this
|------------------------- ---------- ---------- ---------- ---------- ---------- -------|
| ID | | Name | Qty | Stock |
|------------------------- ---------- ---------- ---------- ---------- ---------- -------|
| TextBox | Button | TextBox | TextBox | TextBox |
|------------------------- ---------- ---------- ---------- ---------- ---------- -------|
|TextBox | Button | TextBox | TextBox | TextBox |
|------------------------- ---------- ---------- ---------- ---------- ---------- -------|
|TextBox | Button | TextBox | TextBox | TextBox |
|------------------------- ---------- ---------- ---------- ---------- ---------- -------|
|TextBox | Button | TextBox | TextBox | TextBox |
|------------------------- ---------- ---------- ---------- ---------- ---------- -------|
|TextBox | Button | TextBox | TextBox | TextBox |
|------------------------- ---------- ---------- ---------- ---------- ---------- -------|
"TextBox" means HTML Text box is displayed same with button.
in asp/jsp i can name the controls dynamically and use request.getparameter("cont rolName") to get the value.
but how do i do the same thing using struts frame work? here in the above sample i displayed only 4 rows but in actual case it can be 10/20. is there any way achieving this? i am a newbie to using Struts, please give me step by step example on creating actionform and actionclass.
the working environment is windows + IIS + Tomcat 5 + Struts 1.1
the problem is i need to develop a jsp page using struts framework and the view is something like this
|-------------------------
| ID | | Name | Qty | Stock |
|-------------------------
| TextBox | Button | TextBox | TextBox | TextBox |
|-------------------------
|TextBox | Button | TextBox | TextBox | TextBox |
|-------------------------
|TextBox | Button | TextBox | TextBox | TextBox |
|-------------------------
|TextBox | Button | TextBox | TextBox | TextBox |
|-------------------------
|TextBox | Button | TextBox | TextBox | TextBox |
|-------------------------
"TextBox" means HTML Text box is displayed same with button.
in asp/jsp i can name the controls dynamically and use request.getparameter("cont
but how do i do the same thing using struts frame work? here in the above sample i displayed only 4 rows but in actual case it can be 10/20. is there any way achieving this? i am a newbie to using Struts, please give me step by step example on creating actionform and actionclass.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> can you please explain how do i control how many rows i want to display using the method you posted?
When you create the array of Row objects, only add the number you want to display...
> and what are the entries in struts-config.xml?
You will need a start action that fills in the array of Rows, and an Action as usual to catch the values when the form is posted...
> and can you post a sample for actionclass.
It's the same as any normal action...
When you create the array of Row objects, only add the number you want to display...
> and what are the entries in struts-config.xml?
You will need a start action that fills in the array of Rows, and an Action as usual to catch the values when the form is posted...
> and can you post a sample for actionclass.
It's the same as any normal action...
ASKER
http://www.developer.com/java/ejb/article.php/2233591
still i am intrested if it is possible to do the same using actionform instead of dynaactionform.
TimYates: can you please explain how do i control how many rows i want to display using the method you posted? and what are the entries in struts-config.xml? and can you post a sample for actionclass.