请问struts在JSP页面显示有关问题
请教struts在JSP页面显示问题
IndexAction.java代码:
info.java代码:
index.jsp代码:
上面的index.jsp引用有什么问题?请高手赐教!
------解决思路----------------------
报错信息贴出来看看
------解决思路----------------------
我不知道你想说什么意思??
IndexAction.java代码:
private static final long serialVersionUID = 1L;
private static DbUtil dbUtil=new DbUtil();
private static InfoTypeDao infoTypeDao=new InfoTypeDao();
private InfoDao infoDao=new InfoDao();
private static ArrayList<InfoType> infoTypeList;
private HttpServletRequest request;
public String execute() throws Exception {
Connection con=null;
HttpSession session=request.getSession();
con=dbUtil.getCon();
String sql="select * from tb_info order by infodate desc";
ArrayList<Info> payinfoList=infoDao.getInfoList(con, sql);
request.setAttribute("payinfoList", payinfoList);
return "index";
}
info.java代码:
public class InfoDao {
public ArrayList<Info> getInfoList(Connection con,String sql)throws Exception{
ArrayList<Info> infoList=new ArrayList<Info>();
PreparedStatement pstmt=con.prepareStatement(sql);
ResultSet rs=pstmt.executeQuery();
while(rs.next()){
Info info=new Info();
info.setId(rs.getInt("id"));
info.setTypeId(rs.getInt("typeId"));
info.setTitle(rs.getString("title"));
info.setContent(rs.getString("content"));
info.setLinkman(rs.getString("linkman"));
info.setPhone(rs.getString("phone"));
info.setEmail(rs.getString("email"));
info.setInfoDate(rs.getDate("infoDate"));
info.setState(rs.getInt("state"));
info.setPayfor(rs.getInt("payfor"));
info.setTypeName(rs.getString("typeName"));
infoList.add(info);
}
return infoList;
}
}
index.jsp代码:
<s2:set name="payforlist" value="#request.payforlist"/>
<table border="0" width="670" cellspacing="0" cellpadding="5">
<tr height="35"><td style="text-indent:5" valign="bottom"><font color="#004790"><b>推荐信息</b>缴费专区</font></td></tr>
<tr bgcolor="#FAFCF5">
<td style="border:1 solid">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<s2:if test="#payforlist==null||#payforlist.size()==0">
<tr height="30"><td align="center" style="border:1 solid">缴费后,您发布信息就可在这里显示!</td></tr>
</s2:if>
<s2:else>
<s2:iterator status="payforStatus" value="payforlist">
<s2:if test="#payforStatus.odd"><tr height="23"></s2:if>
<td width="50%"><b><s2:property value="#session.typeMap[infoType]"/></b><a href="info_SingleShow.action?id=<s2:property value='id'/>"><s2:property value="getSubInfoTitle(20)"/></a></td>
<s2:if test="#payforStatus.even"></tr></s2:if>
</s2:iterator>
</s2:else>
</table>
</td>
</tr>
</table>
上面的index.jsp引用有什么问题?请高手赐教!
------解决思路----------------------
报错信息贴出来看看
------解决思路----------------------
我不知道你想说什么意思??