日期:2014-05-17 浏览次数:20886 次
想通过这段代码获得数据库中节点信息的一个集合
public List<tree> allTree() throws Exception{
List<tree> list = getTreeService().listTree();
return list;
}
想通过这段代码来向节点中添加信息(仿照静态节点直接添加信息的过程加了个循环)
<div class="dtree">
<script type="text/javascript">
tree=new dTree("tree");
<%response.setCharacterEncoding("UTF-8");
list_tree lt = new list_tree();
Iterator<tree> dtolte = lt.allTree().iterator();
while(dtolte.hasNext()){
tree tr = dtolte.next();
%>
tree.add('<%=tr.getNodeId()%>','<%=tr.getPreId()%>','forward.jsp?name=<%=tr.getName()%>');
<%
}
%>
document.write(tree);
</script>
</div>
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
root cause
java.lang.NullPointerException
com.tree.save.action.list_tree.allTree(list_tree.java:88)
org.apache.jsp.tree2_jsp._jspService(tree2_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)