help needed in implementing design pattern

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #16
    Originally posted by ajos
    due to some strange reason the values are getting printed.but not on my <option> tag but on my jsp display.why is it not getting displayed on the select tag?
    Do you have that code for creating the options inside a select tag?

    Comment

    • ajos
      Contributor
      • Aug 2007
      • 283

      #17
      Originally posted by r035198x
      Do you have that code for creating the options inside a select tag?
      what 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

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #18
        Originally posted by ajos
        what 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?
        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?

        Comment

        • ajos
          Contributor
          • Aug 2007
          • 283

          #19
          Originally posted by r035198x
          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?
          ok,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

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #20
            Originally posted by ajos
            ok,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?
            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.

            Comment

            • ajos
              Contributor
              • Aug 2007
              • 283

              #21
              Originally posted by r035198x
              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.
              do 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.

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #22
                Originally posted by ajos
                do 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.
                If 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

                • ajos
                  Contributor
                  • Aug 2007
                  • 283

                  #23
                  Originally posted by r035198x
                  If 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]
                  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. :)

                  Comment

                  Working...