Originally posted by ajos
help needed in implementing design pattern
Collapse
X
-
what i did was-->Originally posted by r035198xDo you have that code for creating the options inside a select tag?
[HTML]
<html:select property="branc h">
<html:option value="<%=list. get(i)%>"><%=li st.get(i)%> </html:option>
</html:select>
[/HTML]
the values that were printed was for each.for example
1 option tag for New York,1 for Dallas ....etc.
how will i get them all in 1 option tag?Comment
-
But the code you posted above is different from this. Of course that will gile you an error. i is not declared there. Are you going to try the code I posted?Originally posted by ajoswhat i did was-->
[HTML]
<html:select property="branc h">
<html:option value="<%=list. get(i)%>"><%=li st.get(i)%> </html:option>
</html:select>
[/HTML]
the values that were printed was for each.for example
1 option tag for New York,1 for Dallas ....etc.
how will i get them all in 1 option tag?Comment
-
ok,This is the code that you gave me-->Originally posted by r035198xBut the code you posted above is different from this. Of course that will gile you an error. i is not declared there. Are you going to try the code I posted?
[HTML]
<%
ArrayList<Strin g> list = SelectFactory.g etSelect();
for(int i=0; i < list.size(); i++) {
%>
<select name="branch" size="1">
<OPTION value ="<%=list.get(i )%>"> <%=list.get(i)% > </OPTION>
</select>
<%
}
%>
[/HTML]
now the value that is prointed is 1 option for each city example.1 option property for Dallas,1 for New York ...etc
all the cites are not getting printed in one option tag.why is this?Comment
-
You have put the select tag inside the for loop! You should have that before the for loop otherwise you are tyring to create many selects on the page.Originally posted by ajosok,This is the code that you gave me-->
[HTML]
<%
ArrayList<Strin g> list = SelectFactory.g etSelect();
for(int i=0; i < list.size(); i++) {
%>
<select name="branch" size="1">
<OPTION value ="<%=list.get(i )%>"> <%=list.get(i)% > </OPTION>
</select>
<%
}
%>
[/HTML]
now the value that is prointed is 1 option for each city example.1 option property for Dallas,1 for New York ...etc
all the cites are not getting printed in one option tag.why is this?Comment
-
do you mean it this way?-->Originally posted by r035198xYou have put the select tag inside the for loop! You should have that before the for loop otherwise you are tyring to create many selects on the page.
[HTML]
<%
ArrayList<Strin g> list = SelectFactory.g etSelect(); %>
<select name="branch" size="1">
<OPTION value ="<%=list.get(i )%>"> <%=list.get(i)% > </OPTION>
</select>
<%for(int i=0; i < list.size(); i++) { %>
<%
}
%>
[/HTML]
this wont work coz it again fails to recognize the i variable.Comment
-
If I keep posting in this thread I'm going to go mad.Originally posted by ajosdo you mean it this way?-->
[HTML]
<%
ArrayList<Strin g> list = SelectFactory.g etSelect(); %>
<select name="branch" size="1">
<OPTION value ="<%=list.get(i )%>"> <%=list.get(i)% > </OPTION>
</select>
<%for(int i=0; i < list.size(); i++) { %>
<%
}
%>
[/HTML]
this wont work coz it again fails to recognize the i variable.
[CODE=java] <%
ArrayList<Strin g> list = SelectFactory.g etSelect(); %>
<select name="branch" size="1">
<%
for(int i=0; i < list.size(); i++) {
%>
<OPTION value ="<%=list.get(i )%>"> <%=list.get(i)% >
<%
}
%>
</select>[/CODE]Comment
-
trust me you wont.coz you are doig a great job helping guys like me to learn,i shud had done this bit,im an idiot for reading your last post correctly.thank s very much for all the time taken to help me.I truely appreciate this. :)Originally posted by r035198xIf I keep posting in this thread I'm going to go mad.
[CODE=java] <%
ArrayList<Strin g> list = SelectFactory.g etSelect(); %>
<select name="branch" size="1">
<%
for(int i=0; i < list.size(); i++) {
%>
<OPTION value ="<%=list.get(i )%>"> <%=list.get(i)% >
<%
}
%>
</select>[/CODE]Comment
Comment