显示所有分类
主页中插入一个jsp:
<table class="table" align="center">
<tr class="trTop">
<td colspan="2" class="tdTop">
<iframe frameborder="0" src="<c:url value='/jsps/search.jsp'/>" name="search"></iframe>
</td>
</tr>
</table>
分类模块:
1.发起请求位置:main.jsp中发起请求
创建所有相关类:
cn.itcast.goods.category.
domain.Category
dao.CategoryDao
service.CategoryService
web.servlet.CategoryServlet
//Category->
public class Category{
private String cid;
private String cname;
private Category parent;
private String desc;//分类描述
private List<Category> children;
private Category toCategory(Map<String,Object> map{
Category category = CommonUtils.toBean(map,Category.class);
String pid = (String)map.get("pid");
if(pid!= null){
Category parent = new Category();
parent.setCid(pid);
}
}
}
//CategoryDao->
public class CategoryDao{
private QueryRunner qr = new TxQueryRunner();
public List<Category>findAll(){
//查询所有一级分类
}
}