You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mo...@physics.gmu.edu on 2003/11/19 16:36:15 UTC

using select with country codes

Hi guys
I have a db table called "country_listing" which contains
"contry_codes","country_name".
I also have an "address" table which holds the country_code.
I need to implement a select which
shows these "country_names" in the select box and the when the user choses
a country the "country_code" has to be inserted into the "address" table.
Please let me know how to do it if anyone has done it.

--Thank you
Mohan



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Antwort: using select with country codes

Posted by Manuel Lenz <Lz...@viessmann.com>.




Hi Mohan,
first you have to select your country codes from database.
You can put these values for example into a vector-object.
>From this object you can create a scroll down menu where the user selects
his country.
Example:
The name of this vector is: vorschlagForm.getV_ekg().

<html:select property="ekg" size="" value="<%=banfForm.getEkg()%>">
                  <html:option value=""><bean:message key="un.checkbox"
/></html:option>
                  <!-- Variable Tabellenzeilen -->
                  <%
                        try
                        {
                              Enumeration elem =
vorschlagForm.getV_ekg().elements();

                              while (elem.hasMoreElements())
                              {
                                    ScrollDown sd = (ScrollDown)
elem.nextElement();
                  %>
                              <html:option
value="<%=sd.getEkg()%>"><%=sd.getEkg()%> -
<%=sd.getEkg_name()%></html:option>
                  <%
                              }
                        }
                        catch(Exception e)
                        {
                              System.out.println("Fehler in banf.jsp (225):
" + e.getMessage());
                        }
                  %>
</html:select>

Manuel


|---------+---------------------------->
|         |                            |
|         |                            |
|         |                            |
|         |mohan@physics.gmu.edu       |
|         |19.11.2003 16:36            |
|         |Bitte antworten an "Struts  |
|         |Users Mailing List"         |
|---------+---------------------------->
  >----------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                            |
  |     An:      <st...@jakarta.apache.org>                                                                              |
  |     Kopie:                                                                                                                 |
  |     Thema:   using select with country codes                                                                               |
  >----------------------------------------------------------------------------------------------------------------------------|




Hi guys
I have a db table called "country_listing" which contains
"contry_codes","country_name".
I also have an "address" table which holds the country_code.
I need to implement a select which
shows these "country_names" in the select box and the when the user choses
a country the "country_code" has to be inserted into the "address" table.
Please let me know how to do it if anyone has done it.

--Thank you
Mohan



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org