为什么我的视图数据在jsp中显示不出来?

venus224 2008-06-17 10:39:41
为什么我的视图数据在jsp中显示不出来?
我把视图当成表一样显示,但显示不出来!
关于视图的显示怎么做?在线等!
...全文
235 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
huhai123 2008-07-28
  • 打赏
  • 举报
回复
问我把。我的解决了

<logic:iterate name="GoodsList" id="GList" type="com.workflow.model.view.Goodsview" indexId="index" scope="request">
<% if (index % 2 == 0) { %>
<tr bgcolor="#e2f3fa" height="20" onMouseOut="mout(this,'#e2f3fa');" onMouseOver="mover(this,'#aedefd');">
<% } else { %>
<tr bgcolor="#ffffff" height="20" onMouseOut="mout(this,'#ffffff');" onMouseOver="mover(this,'#aedefd');">
<% } %>

<td ><bean:write name="GList" property="id.goodsId" /></td>
<td ><bean:write name="GList" property="id.goodsName" /></td>
<td ><bean:write name="GList" property="id.norms" /></td>
<td ><bean:write name="GList" property="id.producingArea" /></td>
<td ><bean:write name="GList" property="id.buyPrice" /></td>
<td ><bean:write name="GList" property="id.measureName" /></td>
<td ><bean:write name="GList" property="id.minStock" /></td>
<td ><bean:write name="GList" property="id.maxStock" /></td>
<td ><bean:write name="GList" property="id.remark" /></td>
<td ></td>
<td></td>
</tr>
</logic:iterate>

venus224 2008-06-17
  • 打赏
  • 举报
回复
呼叫高手!
venus224 2008-06-17
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 AWUSOFT 的回复:]
你可以测试一下啊,比如说logic:iterator中随便输出几个字符,看看集合到底有没有数据啊.
[/Quote]
我测试过,可以显示的!
不知道为什么?
awusoft 2008-06-17
  • 打赏
  • 举报
回复
你可以测试一下啊,比如说logic:iterator中随便输出几个字符,看看集合到底有没有数据啊.
venus224 2008-06-17
  • 打赏
  • 举报
回复
没人帮忙???
venus224 2008-06-17
  • 打赏
  • 举报
回复
我在action测试过,可以的!
${admin.id.eventId}
${admin.id.eventDt}
把上面,两个换为1,2是可以出来的!
说明的我all值不是空的!
不知道为什么?难道我的
${admin.id.eventId}
${admin.id.eventDt} 写错了???
venus224 2008-06-17
  • 打赏
  • 举报
回复
大家帮一下忙啊!代码都给了!
awusoft 2008-06-17
  • 打赏
  • 举报
回复
首先要Action里测试一下你是否查询到了数据.
venus224 2008-06-17
  • 打赏
  • 举报
回复
ScspRealtimeEvents.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="org.junshi.vo.ScspRealtimeEvents" table="SCSP_REALTIME_EVENTS">
<composite-id name="id" class="org.junshi.vo.ScspRealtimeEventsId">
<key-property name="eventId" type="java.lang.Long">
<column name="EVENT_ID" />
</key-property>
<key-property name="eventDt" type="java.util.Date">
<column name="EVENT_DT" length="23" />
</key-property>
<key-property name="eventType" type="java.lang.String">
<column name="EVENT_TYPE" length="4" />
</key-property>
<key-property name="eventTypeD" type="java.lang.String">
<column name="EVENT_TYPE_D" length="32" />
</key-property>
<key-property name="assetRid" type="java.lang.Integer">
<column name="ASSET_RID" />
</key-property>
<key-property name="eventSeq" type="java.lang.Integer">
<column name="EVENT_SEQ" />
<key-property name="agentVersion" type="java.lang.String">
<column name="AGENT_VERSION" length="16" />
</key-property>
<key-property name="ntLogSource" type="java.lang.String">
<column name="NtLog_Source" length="2048" />
</key-property>
<key-property name="ntLogEventLog" type="java.lang.String">
<column name="NtLog_EventLog" length="128" />
</key-property>
<key-property name="ntLogEventType" type="java.lang.String">
<column name="NtLog_EventType" length="14" />
</key-property>
<key-property name="ntLogEventId" type="java.lang.String">
<column name="NtLog_EventID" length="512" />
</key-property>
<key-property name="ntLogCategory" type="java.lang.String">
<column name="NtLog_Category" length="128" />
</key-property>
<key-property name="ntLogComputerName" type="java.lang.String">
<column name="NtLog_ComputerName" length="128" />
</key-property>
<key-property name="sysLogFacility" type="java.lang.String">
<column name="SysLog_Facility" length="2048" />
</key-property>
<key-property name="prevModulePath" type="java.lang.String">
<column name="Prev_ModulePath" length="128" />
</key-property>
<key-property name="prevThreadId" type="java.lang.String">
<column name="Prev_ThreadID" length="128" />
</key-property>
<key-property name="prevOsresult" type="java.lang.String">
<column name="Prev_OSResult" length="128" />
</key-property>
<key-property name="prevCspresult" type="java.lang.String">
<column name="Prev_CSPResult" length="128" />
</key-property>
<key-property name="prevRequested" type="java.lang.String">
<column name="Prev_Requested" length="256" />
</key-property>
<key-property name="prevRequestedRw" type="java.lang.String">
<column name="Prev_RequestedRW" length="5" />
</key-property>
<key-property name="prevNtcreateOpt" type="java.lang.String">
<column name="Prev_NTCreateOpt" length="128" />
</key-property>
<key-property name="prevFileFilePath" type="java.lang.String">
<column name="PrevFile_FilePath" length="2048" />
</key-property>
<key-property name="prevRegRegPath" type="java.lang.String">
<column name="PrevReg_RegPath" length="2048" />
</key-property>
<key-property name="prevMemMechanism" type="java.lang.String">
<column name="PrevMem_Mechanism" length="128" />
</key-property>
<key-property name="prevMemInjecteeProcessName" type="java.lang.String">
<column name="PrevMem_InjecteeProcessName" length="128" />
</key-property>
<key-property name="prevMemInjecteeProcessId" type="java.lang.String">
<column name="PrevMem_InjecteeProcessID" length="128" />
</key-property>
<key-property name="prevMemInjecteeThreadId" type="java.lang.String">
<column name="PrevMem_InjecteeThreadID" length="128" />
</key-property>
<key-property name="prevNetProtocol" type="java.lang.String">
<column name="PrevNet_Protocol" length="2048" />
</key-property>
<key-property name="prevNetLocalPort" type="java.lang.String">
<column name="PrevNet_LocalPort" length="128" />
</key-property>
<key-property name="prevNetLocalIp" type="java.lang.String">
<column name="PrevNet_LocalIP" length="128" />
</key-property>
<key-property name="prevNetRemoteIp" type="java.lang.String">
<column name="PrevNet_RemoteIP" length="128" />
</key-property>
<key-property name="prevNetRemotePort" type="java.lang.String">
<column name="PrevNet_RemotePort" length="128" />
</key-property>
<key-property name="prevNetPortService" type="java.lang.String">
<column name="PrevNet_PortService" length="128" />
</key-property>
<key-property name="prevNetPortServiceDescr" type="java.lang.String">
<column name="PrevNet_PortServiceDescr" length="128" />
</key-property>
<key-property name="prevOscallResource" type="java.lang.String">
<column name="PrevOSCall_Resource" length="2048" />
</key-property>
<key-property name="value4" type="java.lang.String">
<column name="VALUE4" length="128" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
venus224 2008-06-17
  • 打赏
  • 举报
回复
action:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package org.junshi.struts.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.junshi.dao.ScspRealtimeEventDAO;
import org.junshi.struts.form.ScspRealtimeEventForm;

/**
* MyEclipse Struts
* Creation date: 06-16-2008
*
* XDoclet definition:
* @struts.action path="/scspRealtimeEvent" name="scspRealtimeEventForm" input="/form/scspRealtimeEvent.jsp" scope="request" validate="true"
*/
public class ScspRealtimeEventAction extends DispatchAction {
/*
* Generated Methods
*/

/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
private ScspRealtimeEventDAO scspRealtimeEventdao;
public ScspRealtimeEventDAO getScspRealtimeEventdao() {
return scspRealtimeEventdao;
}
public void setScspRealtimeEventdao(ScspRealtimeEventDAO scspRealtimeEventdao) {
this.scspRealtimeEventdao = scspRealtimeEventdao;
}
public ActionForward queryAll(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ScspRealtimeEventForm scspRealtimeEventForm = (ScspRealtimeEventForm) form;// TODO Auto-generated method stub
List all = null;
int currentPage = 1;
int lineSize = 5;
int allRecorders = 0;
try {
currentPage = Integer.parseInt(request.getParameter("cp"));
} catch (Exception e) {

}
try {
allRecorders=this.scspRealtimeEventdao.getAllCount();
all = this.scspRealtimeEventdao.queryAllUser(currentPage, lineSize);
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("currentPage", currentPage);
request.setAttribute("lineSize", lineSize);
request.setAttribute("allRecorders", allRecorders);
request.setAttribute("all", all);
System.out.println(allRecorders);
request.setAttribute("jspUrl", "scspRealtimeEvent.do");
request.setAttribute("status", "queryAll");
return mapping.findForward("showit");
}
}

jsp:
<%@ page language="java" pageEncoding="UTF-8"%>

<%@ 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" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />

<title>showit.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>
<center>
<br>
<logic:present name="all" scope="request">
<jsp:include flush="true" page="split_page.jsp">
<jsp:param name="jspUrl" value="${jspUrl}" />
<jsp:param name="lineSize" value="${lineSize}" />
<jsp:param name="allRecorders" value="${allRecorders}" />
<jsp:param name="keyWords"
value="<%=request.getParameter("keyWords")%>" />
<jsp:param name="currentPage" value="${currentPage}" />
<jsp:param name="status" value="${status}" />
<jsp:param name="searchFlag" value="F" />
</jsp:include>
<table border="1" width="100%">

<tr style="background-color: #CCFFFF">
<td style="color:#FF6600;">
列号
<br>
</td>
<td style="color:#FF6600;">
用户名
<br>
</td>
<td style="color:#FF6600;">
密码
<br>
</td>
</tr>
<%
int i=0;
%>
<logic:iterate id="admin" name="all" scope="request">
<tr width="1" heigth="5">
<td>
<%=i+1%>
<%i=i+1; %>
<br>
</td>
<td >
${admin.id.eventId}
<br>
</td>
<td >
${admin.id.eventDt}
<br>
</td>
</tr>
</logic:iterate>
</table>
</logic:present>
</center>
</body>
</html:html>
venus224 2008-06-17
  • 打赏
  • 举报
回复
dao:
package org.junshi.dao;

import java.util.List;

public interface ScspRealtimeEventDAO {
// 计算出总记录数
public int getAllCount()throws Exception;
// 查询出所有的数据
public List queryAllUser(int currentPage, int lineSize)throws Exception;
}
impledao:
package org.junshi.daoImpl;

import java.util.List;

import org.hibernate.Query;
import org.junshi.dao.ScspRealtimeEventDAO;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class ScspRealtimeEventImpl extends HibernateDaoSupport implements
ScspRealtimeEventDAO {

public int getAllCount() throws Exception {

int count=0;
String hql="SELECT COUNT(id.eventId) FROM ScspRealtimeEvents";
Query q=super.getSession().createQuery(hql);
count=(Integer)q.list().get(0);
return count;
}

public List queryAllUser(int currentPage, int lineSize) throws Exception {
String hql="FROM ScspRealtimeEvents";
List all=null;
Query q=super.getSession().createQuery(hql);
q.setFirstResult((currentPage-1)*lineSize);
q.setMaxResults(lineSize);
all=q.list();
return all;
}

}
TRMeister 2008-06-17
  • 打赏
  • 举报
回复
楼主要描述清楚呀~~
laorer 2008-06-17
  • 打赏
  • 举报
回复
视图代码帖出来
zhj92lxs 2008-06-17
  • 打赏
  • 举报
回复
你什么也不给出来,谁知道为什么啊

venus224 2008-06-17
  • 打赏
  • 举报
回复
[Quote=引用 22 楼 AWUSOFT 的回复:]
还没有解决???
[/Quote]
是啊!没有人帮忙!
awusoft 2008-06-17
  • 打赏
  • 举报
回复
还没有解决???
venus224 2008-06-17
  • 打赏
  • 举报
回复
没人会?
唉!一天了!
menu_789 2008-06-17
  • 打赏
  • 举报
回复
venus224 2008-06-17
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 java2000_net 的回复:]
楼主截止到2008-06-17 15:41:18的汇总数据:
发帖数:6
结贴数:2
结贴率:33.33%
[/Quote]
唉!我错了!以后不这样了!
大家帮帮忙吧!
老紫竹 2008-06-17
  • 打赏
  • 举报
回复
楼主截止到2008-06-17 15:41:18的汇总数据:
发帖数:6
结贴数:2
结贴率:33.33%
加载更多回复(4)

67,514

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧