jsp下拉列表框默认显示查询的一条数据可以给select标签赋值,只取其中的一条数据即可。
import java.util.ArrayList;
import java.util.Iterator;
public class Test{
ArrayList list;
// constructor; builds some sample data.
public Test(){
this.list = new ArrayList();
this.list.add(new String[]{"1", "January"});
this.list.add(new String[]{"2", "February"});
this.list.add(new String[]{"3", "March"});
this.list.add(new String[]{"4", "April"});
this.list.add(new String[]{"5", "May"});
this.list.add(new String[]{"6", "June"});
this.list.add(new String[]{"7", "July"});
this.list.add(new String[]{"8", "August"});
this.list.add(new String[]{"9", "September"});
this.list.add(new String[]{"10", "October"});
this.list.add(new String[]{"11", "November"});
this.list.add(new String[]{"12", "December"});
}
[B]
/**
* @return The months of the year as HTML Option tags.
* @param The number of the selected month as a string.
*/
public String getMonthAsOptions(String selectedMonth){
StringBuffer sb = new StringBuffer();
for(Iterator i = this.list.iterator(); i.hasNext(); ){
String[] m = (String[])i.next();
String monthNumber = m[0];
String monthText = m[1];
sb.append("\n");
}
return sb.toString();
}
[/B]
// main method for testing and debugging only
public static void main(String[] args){
String selectedMonth = "4";
if(args.length > 0)
selectedMonth = args[0];
Test test = new Test();
System.out.println(test.getMonthAsOptions(selectedMonth));
}
}
/**假设查找出来的是其他资产
返回回来传到的参数是:message
**/
可以在