社区
Web 开发
帖子详情
为什么我的视图数据在jsp中显示不出来?
venus224
2008-06-18 09:17:24
为什么我的视图数据在jsp中显示不出来?
我把视图当成表一样显示,但显示不出来!
关于视图的显示怎么做?
...全文
142
4
打赏
收藏
为什么我的视图数据在jsp中显示不出来?
为什么我的视图数据在jsp中显示不出来? 我把视图当成表一样显示,但显示不出来! 关于视图的显示怎么做?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
venus224
2008-06-18
打赏
举报
回复
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-18
打赏
举报
回复
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;
}
}
venus224
2008-06-18
打赏
举报
回复
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>
struts2 项目实例
struts2.0 小例子 希望对刚学struts2的同胞能有所帮助
SWFUpload实现多文件上传
SWFUpload实现多文件上传,servlet+
jsp
SSH1框架搭建实例
SSH1框架搭建实例(spring2+struts1+hibernate3)采用旧版本 以资源分销系统物料维护为原型做实例。包括物料的增删改查。包括登录界面。
简述在
JSP
中
,MVC模式
中
的
数据
模型、控制器和
视图
三种角色分别由那种技术担当,具体如何实现
数据
模型(Model):一个或多个 Javabean 对象,用于存储
数据
。Javabean 主要提供简单 的 setXxx 方法和 getXxx 方法,在这些方法
中
不涉及对
数据
的具体处理细节,以便增强模型 的通用性。
视图
(View):一个或多个
JSP
页面,其作用是向控制器提交必要的
数据
和
显示
数据
。
JSP
页面可以使用 HTML 标记、Javabean 标记以及 Java 程序片或 Java 表达式来
显示
数据
。 控制器(Controller):一个或多个 servlet 对象,根据
视图
提交的要求进行数
在
jsp
页面上
显示
数据
库
中
的
数据
-(一)
前言 自己想跟着课本做一个简单的JavaWeb的图书馆管理系统,在项目连接
数据
库成功后,想在
jsp
页面上
显示
数据
库
中
的内容,一直不能实现。今天看了众多博主的博客后,跟着他们所给的项目自己尝试了一下。成功了,嘻嘻。 现在记录一下。本人使用的MySQL
数据
库,Navicat
数据
库
视图
管理工具,Eclipse工具,Tomcat服务器。 总结 综合众多博主的博客,我个人认为想在页面上
显示
数据
库
中
的内容,其...
Web 开发
81,117
社区成员
341,739
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章