<%@page import="com.service.CategoryService"%>
<%@page import="com.po.Category"%>
<%@page import="org.springframework.context.support.ClassPathXmlApplicationContext"%>
<tr>
<td align="right">所属类型:</td>
<td><select name="categoryId" >
<option selected="selected">==请选择==</option>
<%
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
CategoryService categoryService = (CategoryService)ctx.getBean("categoryService");
List<Category> cList = categoryService.getAllCategory();
for(int i =0 ; i< cList.size();i++){
Category c = cList.get(i);
%>
<option value="<%=c.getCategoryId() %>" ><%=c.getCategoryname() %></option>
<%
}
%>
</select></td>
</tr>
jsp中引用Dao或Service
最新推荐文章于 2022-05-13 09:51:03 发布