action
public String doApplyArtcleClass(){
page=new Page(0, Integer.MAX_VALUE);
articleClassInfo = new ArticleClassInfo();
page = articleClassService.getArticleClassPage(articleClassInfo, page, sort, dir);
this.data = page.getData();
//判断下一条数据的是否有子栏目
for(int i=0;i<(page.getData().size());i++){
ArticleClassInfo articleClassInfo = new ArticleClassInfo();
articleClassInfo=(ArticleClassInfo) data.get(i);
if(i == (this.data.size()-1)){
articleClassInfo.setClass_flag("﹄");
break;
}
if(articleClassInfo.getDepth()==1){
if(((ArticleClassInfo) data.get(i+1)).getDepth()==2){
articleClassInfo.setClass_flag("✚");
}else {
articleClassInfo.setClass_flag("﹄");
}
}else if(articleClassInfo.getDepth()==2){
if(((ArticleClassInfo) data.get(i+1)).getDepth()==3){
articleClassInfo.setClass_flag("✚");
}else {
articleClassInfo.setClass_flag("﹄");
}
}else{
articleClassInfo.setClass_flag("﹄");
}
}
return "index";
}
jsp页
<td class="spantd">
<s:if test="depth==1"> <s:property value="class_flag" /> <b><s:property value="class_name"/></b></s:if>
<s:if test="depth==2"> <s:property value="class_flag" /> <s:property value="class_name"/></s:if>
<s:if test="depth==3"> <s:property value="class_flag" /> <s:property value="class_name"/></s:if>
</td>
完成样式
本文仅个人总结经验