当然可以,用logic:present用标签,和你的判断一样,只不过不像你那样,就写一个</logic:iterate>,这个药都写上<logic:present name="nlist">
<logic:iterate id="course" name="nlist" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
......
</logic:iterate>
</logic:present>
<logic:notPresent name="nlist">
<logic:iterate id="course" name="mcList" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
....
</logic:iterate>
</logic:notPresent>
<logic:iterate id="course" name="nlist" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
......
</logic:iterate>
</logic:present>
<logic:notPresent name="nlist">
<logic:iterate id="course" name="mcList" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
....
</logic:iterate>
</logic:notPresent>
解决方案 »
- 谁能帮忙写个傻瓜式简单的java+access数据库教程,让我java数据库入门。
- 怎么在PB中调用JAVA类
- 请教:用java语句实现生成扩展名为DBF的文件,在线等
- 用Tomcat显示Java Servlet,怎样才能发布一个java程序?(如http://192.168.1.1:8080/testjava)
- 高分请教如何在客户端生成webservice的代理类。在线等答案
- 请问:java.sql.RetsultSet中的.last()的操作机制是什么?此操作效率很低。
- 同样jsp文件dreamweaver打开正常,JB9打开中文内容为乱吗,运行显示为乱吗,服务器WEBLOGIC8
- 初学java不太明白J2EE,求助;(
- Jbuider7和Jbuider8可以共存吗?
- 关于 流程引起跟任务调度的疑问
- struts+hibernate上传图片到数据库的问题!!!
- 【贴图】继续分享下自己做图表的体会
.... 一直到</logic:iterate>的内容非常长而且两部分完全一样,所以能否只区别<logic:iterator...头部,其它用一个
ArrayList nlist=request.getAttribute("nlist");
if(nlist!=null) {
%>
<logic:iterate id="course" name="nlist" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
<%} else {
ArrayList mcList=request.getAttribute("mcList");
%>
<logic:iterate id="course" name="mcList" type="rtvu.specialtyrule.common.vo.ModuleCourse" offset="1" indexId="index">
<%}%> ....
</logic:iterate>
参照以上程序改一下,试试!
我感觉你的mcList应该为null 所以应该是空指针异常!
请按照规定写,你说的头比较多,如果你用嵌入java代码写,自己感觉一下哪个更乱,节省了</logic:iterate>,引入了一大堆的<%xxx
而且容易出错,自己考虑