现在有一个aaa.properties文件,内容格式xxx=yyy,现在要将xxx都取出来绑定到struts2的下拉列表中?我的代码是这样的:
<%@ include file="../bas/common.jsp"%>
<HTML><HEAD><TITLE></TITLE></HEAD>
<%
List list=new ArrayList();
Properties p=new Properties();
p.load(new FileInputStream(new File("D:\\aaa.properties")));
Iterator it=p.entrySet().iterator();
while(it.hasNext()){
Entry e=(Entry)it.next();
list.add(e.getKey());
}
request.setAttribute("bbb",list);
%>
<BODY style="color:white;background-color: #3B548F" onload="loadselect();"><!-- onload="DoSearch();"-->
<s:form id="frmSearch" name="frmSearch" action="/mainservlet" target="right_frame" cssStyle="width:100%">
<s:select id="tempselect" label="模板名" labelposition="top" name="demandtype" cssStyle="background-color:#fff3e6;width:100%"
list="#{<%=request.getAttribute("bbb") %>}"></s:select>
<s:submit type="image" name="SearchBtn" value="查询" onclick="DoSearch()" src="../resources/images/Search_CHN.gif" cssStyle="width:73" />
<s:hidden name="operationId" value="TempOperation" />
</s:form>
</BODY>
</HTML>希望各位了解这方面知识的大侠看看我错在哪里了?谢谢了
<%@ include file="../bas/common.jsp"%>
<HTML><HEAD><TITLE></TITLE></HEAD>
<%
List list=new ArrayList();
Properties p=new Properties();
p.load(new FileInputStream(new File("D:\\aaa.properties")));
Iterator it=p.entrySet().iterator();
while(it.hasNext()){
Entry e=(Entry)it.next();
list.add(e.getKey());
}
request.setAttribute("bbb",list);
%>
<BODY style="color:white;background-color: #3B548F" onload="loadselect();"><!-- onload="DoSearch();"-->
<s:form id="frmSearch" name="frmSearch" action="/mainservlet" target="right_frame" cssStyle="width:100%">
<s:select id="tempselect" label="模板名" labelposition="top" name="demandtype" cssStyle="background-color:#fff3e6;width:100%"
list="#{<%=request.getAttribute("bbb") %>}"></s:select>
<s:submit type="image" name="SearchBtn" value="查询" onclick="DoSearch()" src="../resources/images/Search_CHN.gif" cssStyle="width:73" />
<s:hidden name="operationId" value="TempOperation" />
</s:form>
</BODY>
</HTML>希望各位了解这方面知识的大侠看看我错在哪里了?谢谢了
这个项目仅仅是用struts2来做前台页面的效果,后台并不是用struts2,而是Servlet