我不是高手这个手工添加一下不就行了吗?
<html:option value="1">一月</html:option>
...
<html:option value="1">一月</html:option>
...
解决方案 »
- hibernate3.6级联保存出错
- file://路径,在jsp里面不能打开的问题
- 一个关于log4j问题,将日志信息记录到mysql中
- 阿里技术 antx
- 要面试J2EE了,大家出出点子,万分感谢!!!!!!!
- [转发]:XML Schema用法,XML Spy和Cape Clear Studio都是具有XML Schema创建功能的全方位XML综合开发环境。dtd2xs是一种DTD-to-XML的Sch
- JAVA中文问题?
- sun公司的资深工程师给我们培训,但是我们!跟贴有分!
- oracle动态sql问题求解,希望大牛指点指点
- if判断a,b,c三个人随机说一句话但是一个人不能重复说
- 十万火急:关于缩短Tomcat中首页的访问地址问题
- 请教高手一个关于weblogic的问题。。。。。。在线等待。。。。。。先谢了。。。。
The property attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the value that will be returned to the server if this option is selected.
The labelProperty attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the label that will be displayed to the user for this option. If the labelProperty attribute is not specified, the property named by the property attribute will be used to select both the value returned to the server and the label displayed to the user for this option.
If the collection attribute is not specified, the rules described in the remainder of this section apply.The collection of values actually selected depends on the presence or absence of the name and property attributes. The following combinations are allowed:Only name is specified - The value of this attribute is the name of a JSP bean in some scope that is the collection.
Only property is specified - The value of this attribute is the name of a property of the ActionForm bean associated with our form, which will return the collection.
Both name and property are specified - The value of the name attribute identifies a JSP bean in some scope. The value of the property attribute is the name of some property of that bean which will return the collection.
The collection of labels displayed to the user can be the same as the option values themselves, or can be different, depending on the presence or absence of the labelName and labelProperty attributes. If this feature is used, the collection of labels must contain the same number of elements as the corresponding collection of values. The following combinations are allowed:Neither labelName nor labelProperty is specified - The labels will be the same as the option values themselves.
Only labelName is specified - The value of this attribute is the name of a JSP bean in some scope that is the collection.
Only labelProperty is specified - The value of this attribute is the name of a property of the ActionForm bean associated with our form, which will return the collection.
Both labelName and labelProperty are specified - The value of the labelName attribute identifies a JSP bean in some scope. The value of the labelProperty attribute is the name of some property of that bean which will return the collection.
Note that this tag does not support a styleId attribute, as it would have to apply the value to all the option elements created by this element, which would mean that more than one id element might have the same value, which the HTML specification says is illegal.
Attribute Name Description
collection Name of the JSP bean (in some scope) which is itself a Collection of other beans, each of which has properties named by the "property" and "labelProperty" attributes that are used to retrieve the value and label for each option, respectively. (RT EXPR)
filter Set to false if you do NOT want the option labels filtered for sensitive characters in HTML. By default, such values are filtered. (RT EXPR)
labelName Name of the JSP bean (in some scope) containing the collection of labels to be displayed to the user for these options. (RT EXPR)
labelProperty Property of the form bean, or the bean specified by the labelName attribute, that will return the collection of labels to be displayed to the user for these options. (RT EXPR)
name Name of the JSP bean (in some scope) containing the collection of values to be returned to the server for these options. If not specified, the form bean associated with our form is assumed. (RT EXPR)
property Property of the form bean, or the bean specified by the name attribute, that will return the collection of values to returned to the server for these options. (RT EXPR)
<option value=""></option>
<html:optionsCollection name="users1"/>
</html:select>public class DepatmentAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception ,SQLException, NamingException{
Statement statement = null;
List list1 = new ArrayList(); DepartmentForm df = (DepartmentForm)form;
Context ctx = (Context) new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/OracleDB");
Connection connection1 = ds.getConnection();
statement = connection1.createStatement();
String sql = "select DEPARTMENT_ID,DEPARTMENT_NAME from TEST_DEPARTMENT";
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
list1.add(new LabelValueBean((String) rs
.getString("DEPARTMENT_NAME"), (String) rs
.getString("DEPARTMENT_ID")));
}
if (statement != null) {
statement.close();
connection1.close();
}
df.setList1(list1);
request.getSession().setAttribute("users1", list1);
return mapping.findForward("check");
}
}上面是从数据库中检索结果,你可以直接把月份放到list中
<%
String str_month="<option value=''>请选择</option>";
for(int i=1;i<=12;i++)
{
str_month+="<option value=\""+i+"\">"+i+"</option> ";
}
%>
<select name="MONTH"><%=str_month%>
</select>构造日下拉框:<select name="fromdate">
<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option>
<option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option>
<option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option>
<option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option>
<option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option>
<option value="26">26</option><option value="27">27</option><option value="28">28</option>
</select>