-
1. Re: Listen JSP
hraun Nov 14, 2001 9:59 PM (in response to kramisimo)Krami
Erm, I'm not sure that I understood the question correctly (Babelfish isn't perfect :^D ).
I gather what you are asking is:
"If I can create a dynamic list like this:
< input type="text " name="QTY[ ] " size="5 " VALUE = " < %=warenkorb,getQTY(i)% > " >
How can I get the name to be dynamic too? "
If that is your question, then this is my answer:
One idea would just be to concatenate the name to the array value like this:
name="<%="QTY"+i%>"
But I wonder how you would then read the values in your servlet. The way I do it is like this:
< input type="text " name="QTY" size="5 " VALUE = " < %=warenkorb,getQTY(i)% > " >
Then I can get all the values that the user entered in the form of an array. like this:
String quantities = request.getParameterValues("QTY");
Hope this helps ?!
Bis bald
Peet
ps (try babelfish http://world.altavista.com/tr) -
2. Re: Listen JSP
jcordes Nov 15, 2001 7:14 AM (in response to kramisimo)Hi !
You can create a dynamic list like this
<% for (int i=0; i < myArray.length; i++){ %>
<input type="text" name="QTY" size="5" VALUE="<%=myArray%>">
<% } %>
If you're using the same name for input-fields you get an array of values (for example in your servlet). You have no other chance then to iterate through your array, setting them individually.
Bye,
Jochen.