社区
Web 开发
帖子详情
为什么我的视图数据在jsp中显示不出来?
venus224
2008-06-18 09:17:24
为什么我的视图数据在jsp中显示不出来?
我把视图当成表一样显示,但显示不出来!
关于视图的显示怎么做?
...全文
137
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 项目实例
例如,在Action类
中
设置一个属性`message`,然后在
JSP
中
可以通过`${message}`来获取并
显示
这个值。 拦截器(Interceptor)是Struts2的一个重要特性,它们可以对Action调用前后进行额外的操作,如日志记录、权限验证...
SWFUpload实现多文件上传
8. **错误处理**:在实际应用
中
,可能会遇到各种上传问题,如网络
中
断、文件过大、文件类型不合法等。因此,需要编写健壮的错误处理机制,确保在出现问题时能够给出清晰的反馈。 综上所述,SWFUpload是一个强大的...
SSH1框架搭建实例
我们需要在applicationContext.xml
中
配置Bean,包括
数据
源、事务管理器、Hibernate SessionFactory以及业务服务接口和实现。例如,定义一个`MaterialService`接口及其实现`MaterialServiceImpl`,并注入到Action
中
...
简述在
JSP
中
,MVC模式
中
的
数据
模型、控制器和
视图
三种角色分别由那种技术担当,具体如何实现
的 setXxx 方法和 getXxx 方法,在这些方法
中
不涉及对
数据
的具体处理细节,以便增强模型 的通用性。
视图
(View):一个或多个
JSP
页面,其作用是向控制器提交必要的
数据
和
显示
数据
。
JSP
页面可以使用 HTML 标记、...
在
jsp
页面上
显示
数据
库
中
的
数据
-(一)
自己想跟着课本做一个简单的JavaWeb的图书馆管理系统,在项目连接
数据
库成功后,想在
jsp
页面上
显示
数据
库
中
的内容,一直不能实现。今天看了众多博主的博客后,跟着他们所给的项目自己尝试了一下。成功了,嘻嘻。 ...
Web 开发
81,122
社区成员
341,744
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章