* @return int status
* @exception JspException if a JSP exception has occurred
* @see javax.servlet.jsp.tagext.Tag#doStartTag()
*/
public int doStartTag() throws JspException {
ExpressionEvaluator eval = new ExpressionEvaluator(this, pageContext);
if (selected != null) {
selected = eval.evalString("default", selected);
}
Locale userLocale = pageContext.getRequest().getLocale();
List countries = this.buildCountryList(userLocale);
if (scope != null) {
if (scope.equals("page")) {
pageContext.setAttribute(name, countries);
} else if (scope.equals("request")) {
pageContext.getRequest().setAttribute(name, countries);
} else if (scope.equals("session")) {
pageContext.getSession().setAttribute(name, countries);
} else if (scope.equals("application")) {
pageContext.getServletContext().setAttribute(name, countries);
} else {
throw new JspException("Attribute 'scope' must be: page, request, session or application");
}
} else {
StringBuilder sb = new StringBuilder();
sb.append("<select name=\"").append(name).append("\" id=\"").append(name).append("\" class=\"form-control\">\n");
if (prompt != null) {
sb.append(" <option value=\"\" selected=\"selected\">");
sb.append(eval.evalString("prompt", prompt)).append("</option>\n");
}
for (Object country1 : countries) {
LabelValue country = (LabelValue) country1;
sb.append(" <option value=\"").append(country.getValue()).append("\"");