81,094
社区成员
发帖
与我相关
我的任务
分享
class WebOption implements Comparable{
String name;
String url;
int selectname;
int compareTo(WebOption option){
return this.selectname - option.selectname;
}
}
List webOptionList;
Collections.sort(webOptionList);
int size = webOptionList!=null?webOptionList.size():0;
for(int i=0, old=-1; i<size; ++i){
webOption = (WebOption)webOptionList.get(i);
if(webOption.getSelectname()!=old){
if(i>0)
buffer.append("</select>");
buffer.append("<select name=\"select")
.append(webOption.getSelectname())
.append("\" onclick='window.open(this.value,'_blank')\">");
}
buffer.append("<option value=\"")
.append(webOption.getUrl())
.append("\">")
.append(webOption.getName())
.append("</option>");
}
if(size>0)
buffer.append("</select>");