@Override
public int doStartTag()
throws JspException
{
// Select Input Tag
HtmlWriter w = new HtmlWriter(pageContext.getOut());
HtmlTag select = w.startTag("select");
addStandardAttributes(select, null);
select.addAttribute("name", getTagName(name));
select.addAttribute("disabled", getBoolean(disabled, false));
select.addAttribute("tabindex", this.tabindex);
// Event Attributes
select.addAttribute("onclick", this.onclick);
select.addAttribute("onchange", this.onchange);
select.addAttribute("onfocus", this.onfocus);
select.addAttribute("onblur", this.onblur);
select.beginBody(true);
// Render List of Options
if (options!=null)
{ // Render option list
Object current = getValue();
if (getBoolean(allownull, false) && options.contains(null)==false)
{ // add an empty entry
HtmlTag option = w.startTag("option");
option.addAttributeNoCheck("value", "", false);
option.addAttribute("selected", ObjectUtils.isEmpty(current));
option.beginBody("");
option.endTag(true);
}
for (OptionEntry entry : options)
{
Object value = entry.getValue();
boolean isCurrent = ObjectUtils.compareEqual(current, value);
// Add Option entry
HtmlTag option = w.startTag("option");
option.addAttributeNoCheck("value", value, true);
option.addAttribute("selected", isCurrent);
option.beginBody(getTranslation(entry.getText()));
option.endTag(true);
}