Here you can find the source of getDaySelect(String selectName, String value, boolean hasBlank)
public static String getDaySelect(String selectName, String value, boolean hasBlank)
//package com.java2s; //License from project: Apache License public class Main { public static String getDaySelect(String selectName, String value, boolean hasBlank) { StringBuffer sb = new StringBuffer(""); sb.append("<select name=\"" + selectName + "\">"); if (hasBlank) { sb.append("<option value=\"\"></option>"); }//from ww w . ja v a 2 s . c o m for (int i = 1; i <= 31; i++) { if (!value.trim().equals("") && i == Integer.parseInt(value)) { sb.append("<option value=\"" + i + "\" selected>" + i + "</option>"); } else { sb.append("<option value=\"" + i + "\">" + i + "</option>"); } } sb.append("</select>"); return sb.toString(); } public static String getDaySelect(String selectName, String value, boolean hasBlank, String js) { StringBuffer sb = new StringBuffer(""); sb.append("<select name=\"" + selectName + "\" " + js + ">"); if (hasBlank) { sb.append("<option value=\"\"></option>"); } for (int i = 1; i <= 31; i++) { if (!value.trim().equals("") && i == Integer.parseInt(value)) { sb.append("<option value=\"" + i + "\" selected>" + i + "</option>"); } else { sb.append("<option value=\"" + i + "\">" + i + "</option>"); } } sb.append("</select>"); return sb.toString(); } }