<%--
  -- countries.jsp
  --
  -- Required Parameters:
  --   * label  - The description that will be used to identfy the control.
  --   * name   - The name of the attribute to put and pull the result from.
  --              Equates to the NAME parameter of the HTML SELECT tag.
  --   * list   - Iterator that will provide the options for the control.
  --              Equates to the HTML OPTION tags in the SELECT and supplies
  --              both the NAME and VALUE parameters of the OPTION tag.
  --
  -- Optional Parameters:
  --   * labelposition   - determines were the label will be place in relation
  --                       to the control.  Default is to the left of the control.
  --   * size            - SIZE parameter of the HTML SELECT tag.
  --   * disabled        - DISABLED parameter of the HTML SELECT tag.
  --   * tabindex        - tabindex parameter of the HTML SELECT tag.
  --   * onchange        - onkeyup parameter of the HTML SELECT tag.
  --   * size            - SIZE parameter of the HTML SELECT tag.
  --
  --%>
<%@ taglib uri="webwork" prefix="webwork" %>
<%@ include file="controlheader.jsp" %>
<%
    webwork.util.ValueStack vs = webwork.util.ValueStack.getStack( pageContext );
    String nameValue = (String) vs.findValue( "parameters['nameValue']" );
%>

<webwork:action name="'CountriesList'" id="countrieslist">
<select name="<webwork:property value="parameters['name']"/>"
      <webwork:property value="parameters['id']">
         <webwork:if test=".">id="<webwork:property value="."/>"</webwork:if>
      </webwork:property>
      <webwork:property value="parameters['disabled']">
         <webwork:if test="parameters['disabled'] == true">disabled="disabled"</webwork:if>
      </webwork:property>
      <webwork:property value="parameters['size']">
         <webwork:if test=".">size="<webwork:property value="."/>"</webwork:if>
      </webwork:property>
      <webwork:property value="parameters['tabindex']">
         <webwork:if test=".">tabindex="<webwork:property value="."/>"</webwork:if>
      </webwork:property>
      <webwork:property value="parameters['onchange']">
         <webwork:if test=".">onchange="<webwork:property value="."/>"</webwork:if>
      </webwork:property>
>
<%
    LucasOnline.common.ejb.Country country = null;
    java.util.Collection countries = (java.util.Collection) vs.findValue("@countrieslist/countries");
    for (java.util.Iterator iter = countries.iterator(); iter.hasNext(); ) {
        country = (LucasOnline.common.ejb.Country) iter.next();
%>
  <option value="<%= country.getCountryCode() %>"<% if (country.getCountryCode().equals(nameValue)) { out.println("selected=\"selected\""); }%>>
  <%= country.getDescription() %>
  </option>
<%
    }
%>
</select>
</webwork:action>

<%@ include file="controlfooter.jsp" %>
