Tzanko Stefanov

Greenhorn
+ Follow
since Nov 14, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tzanko Stefanov

sorry I made a mistake
<logic:iterate id="id" name="nameForm" property="list" indexed="idx"> <TR> <TD><html:text name ="id" property="<%="name["+idx+"]">" />....
instead of having setAge(int)/getAge(int) you can return a collection instead. For example:
public java.util.List getAge()
20 years ago
Here is an idea - should work, but let me know if so.
Create a getter/setter
setAge(int i) - It will put an element in a Collection on the position provided by i (so you will have a private Collection data member in your form). The same thing should be done for your name property.
Now modify your code accordingly
<logic:iterate id="id" name="nameForm"property="list" indexed="idx"><TR><TD><html:text name ="id" property="<%="name"+idx>" /></TD><TD><html:text name ="id" property="<%="age"+idx>" /></TD></TR></logic:iterate>
I cannot test it now but smth tells me that this is one possible option (or at least smth simillar). I appologize if I am providing misleading info here.
20 years ago
Setting the form bean property is not done on the server side when the request is posted. The form bean properties will be set even if you use plain html inputs with names corresponding to the bean property.
We change the values of the inputs via JS all the time. <html:text ...> will generate an input tag with the name specified. Then you just set the value of that element and submit the form! Do not forget to submit the form in you JS when using an event like onSubmit="yourFunction()"
20 years ago
I am not sure whether this is what are you trying to do, but if you want to access the Context from an Action class you can do that with:
getServlet().getServletContext()
Then you can set and get Attributes in the application context.
20 years ago