@SuppressWarnings("unchecked")
private String encodeOptions(FacesContext facesContext, PickList pickList, List model) throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
String var = pickList.getVar();
Converter converter = pickList.getConverter();
StringBuffer state = new StringBuffer();
for(Object item : model) {
facesContext.getExternalContext().getRequestMap().put(var, item);
String value = converter != null ? converter.getAsString(facesContext, pickList, pickList.getItemValue()) : (String) pickList.getItemValue();
writer.startElement("option", null);
writer.writeAttribute("value", value, null);
writer.write(pickList.getItemLabel());
writer.endElement("option");