在页面上我是这样的:
<logic:iterate name="beanlist" id="editlist">
<tr>
<td><bean:write name="editlist" property="name"</td>
<td><bean:write name="editlist" property="sex"</td>
<td><bean:write name="editlist" property="city"</td>
</tr>
</logic:iterate>
但是不能实现。为什么啊??
<logic:iterate name="beanlist" id="editlist">
<tr>
<td><bean:write name="editlist" property="name"</td>
<td><bean:write name="editlist" property="sex"</td>
<td><bean:write name="editlist" property="city"</td>
</tr>
</logic:iterate>
但是不能实现。为什么啊??
解决方案 »
- 请问Struts怎么设置跳转带参数的链接啊
- struts2 form的method 默认值是post还是什么
- BufferedReader乱码的问题
- 给个struts的简单事例,感谢!
- 大家帮我看看weblogic 上这个数据库连接池的抱错是怎么回事?
- Style Report
- Hibernate中的综合查询问题
- 大虾快来啊,送分啊,简单的j2ee环境问题。
- 救命啊::session中保留有客户端的IP吗?如果有,请问怎样获取?
- 用struts2框架,怎样遍历一个这样的集合。
- 谁有struts简单的例子,一定要正确的。
- struts中我在applicationresource.properties中的中文在jsp页面显示乱码
<@ taglib......
package com.xuhua.feedback;import org.apache.struts.action.*;
import java.util.*;
import javax.servlet.http.*;
import com.xuhua.system.User;
import javax.sql.DataSource;
import java.sql.SQLException;
public class feedbackAction extends Action {
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception {
/**@todo: complete the business logic here, this is just a skeleton.*/
backActionForm back = (backActionForm) actionForm;
DataSource ds = getDataSource(request,"conPool");
backBean feed = new backBean(ds);
Collection c=new ArrayList();
String id=request.getParameter("id");
try{
if(id!=null&&id.equals("find")){
c=feed.queryback();
request.setAttribute("beanlist",c);
}
}catch(SQLException e){
System.out.print(e);
}
return null;
}
}jsp的代码:<%@ page contentType="text/html; charset=GB2312" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html>
<head>
<title>
editlist
</title>
</head>
<body>
<table>
<logic:iterate name="beanlist" id="editlist">
<tr>
<td><bean:write name="editlist" property="name"</td>
<td><bean:write name="editlist" property="sex"</td>
<td><bean:write name="editlist" property="city"</td>
</tr>
</logic:iterate>
</table>
</body>
</html>
package com.xuhua.feedback;import org.apache.struts.action.*;
import java.util.*;
import javax.servlet.http.*;
import com.xuhua.system.User;
import javax.sql.DataSource;
import java.sql.SQLException;
public class feedbackAction extends Action {
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception {
/**@todo: complete the business logic here, this is just a skeleton.*/
backActionForm back = (backActionForm) actionForm;
DataSource ds = getDataSource(request,"conPool");
backBean feed = new backBean(ds);
Collection c=new ArrayList();
String id=request.getParameter("id");
try{
if(id!=null&&id.equals("find")){
c=feed.queryback();
request.setAttribute("beanlist",c);
}
}catch(SQLException e){
System.out.print(e);
}
return actionMapping.findForward("success");
}
}
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html>
<head>
<title>
editlist
</title>
</head>
<body>
<table>
<logic:iterate name="beanlist" id="editlist" type="java.util.ArrayList">
<tr>
<td><bean:write name="editlist" property="name"/></td>
<td><bean:write name="editlist" property="sex"/></td>
<td><bean:write name="editlist" property="city"/></td>
</tr>
</logic:iterate>
</table>
</body>
</html>
<action-mappings>
<action name="backActionForm"
type="feedbackAction"
validate="true"
scope="request"
path="/feedbackAction">
<forward name="success"
path="/edit.jsp"
redirect="false"/>
</action>
</action-mappings>
c=feed.queryback();
request.setAttribute("beanlist",c);
}
你把c里的东西取出来,在action里打印一下,看看有没有呢,也许可能是个空值。
如果有值说明问题是在jsp页面,不在后面的DB。