建了个没带Form、Action的JSP的页面,想迭代出数据库里某表某字段的全部记录!(在线等)
jsp里的代码:
<%@ page language= "java " pageEncoding= "GBK "%>
<%@ taglib uri= "http://struts.apache.org/tags-bean " prefix= "bean " %>
<%@ taglib uri= "http://struts.apache.org/tags-html " prefix= "html " %>
<%@ taglib uri= "http://struts.apache.org/tags-logic " prefix= "logic " %>
<%@ taglib uri= "http://struts.apache.org/tags-tiles " prefix= "tiles " %>
<jsp:useBean id= "web_menuVO " class= "com.kzon.DAO.web_menuDao " scope= "page "> </jsp:useBean>
<bean:define id= "vo " name= "web_menuVO " property= "firstmenu_name "> </bean:define>
<html:html lang= "true ">
<head>
<html:base />
<title> menu.jsp </title>
<meta http-equiv= "pragma " content= "no-cache ">
<meta http-equiv= "cache-control " content= "no-cache ">
<meta http-equiv= "expires " content= "0 ">
<meta http-equiv= "keywords " content= "keyword1,keyword2,keyword3 ">
<meta http-equiv= "description " content= "This is my page ">
<!--
<link rel= "stylesheet " type= "text/css " href= "styles.css ">
-->
</head>
<body>
<logic:iterate id= "vo ">
<table>
<tr>
<th> 目录名 </th>
</tr>
<tr>
<td>
<bean:write name= "vo " property= "menu_name "/>
</td>
</tr>
</table>
</logic:iterate>
</body>
</html:html>
启动服务后报:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception thrown by getter for property firstmenu_name of bean web_menuVO
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
[解决办法]
<logic:iterate id= "vo ">
你这里面少了个要循环的对象
最好判断一下,是否有这个对象存在
<logic:present name= "articleList ">
<logic:iterator id= "vo " name= "articleList ">
这里进行操作
</logic:iterator>
</logic:presetn>
[解决办法]
有没有menu_name的get方法???
最好不要用这种带下划线的变量命名
menuName不好么?
[解决办法]
是firstmenu_name啊.
[解决办法]
List list = ..DAO.getList()方法
if(list!=null){
Iterator i = list.iterator();
while(i.hasNext()){
web_menuVO v = i.next();
<TD> <%=v.getMenu_name()%> </TD>
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html