社区
Web 开发
帖子详情
为什么我的视图数据在jsp中显示不出来?
venus224
2008-06-18 09:17:24
为什么我的视图数据在jsp中显示不出来?
我把视图当成表一样显示,但显示不出来!
关于视图的显示怎么做?
...全文
179
4
打赏
收藏
为什么我的视图数据在jsp中显示不出来?
为什么我的视图数据在jsp中显示不出来? 我把视图当成表一样显示,但显示不出来! 关于视图的显示怎么做?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用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>
Jsp
从
数据
库读取并
显示
图片
本文介绍了如何解决在
JSP
中
从
数据
库读取图片时遇到的异常问题。由于
JSP
的输出流已由Servlet打开,因此直接在
JSP
中
处理图片
显示
不可行。解决方案是使用Servlet来读取和输出图片,通过Servlet的输出流直接
显示
图片,避免了冲突。文
中
给出了详细的Servlet代码示例,并展示了如何在前端HTML
中
引用该Servlet来
显示
图片。
在
jsp
页面上
显示
数据
库
中
的
数据
-(一)
本文介绍如何使用JavaWeb在
jsp
页面上
显示
MySQL
数据
库
中
的内容,包括
数据
库连接、
JSP
代码编写及运行结果,适合初学者参考。
Spring框架,如何返回
数据
给
视图
(
jsp
文件)
本文介绍如何使用Spring Portlet进行
数据
查询并将查询结果返回到
视图
进行展示的方法。具体包括控制器
中
查询
数据
并传递给
视图
的过程,以及
视图
层如何接收并
显示
这些
数据
。
.
jsp
获取不到ModelAndView的
数据
的解决方案
本文讲述了在SpringMVC框架
中
,如何正确使用ModelAndView在控制器与
视图
间传递
数据
,以及遇到
数据
无法在
JSP
页面获取的常见问题,包括
数据
添加、
视图
解析器配置、
JSP
引用和请求处理流程,提供了详细的解决方法和调试建议。
第二章 搭建Springboot环境,配置
视图
解析器
jsp
页面
本文介绍如何搭建SpringBoot开发环境,并配置
视图
解析器以支持
JSP
页面
显示
。主要内容包括设置IDEA开发环境、添加
JSP
依赖、自定义
视图
前后缀等。
Web 开发
81,111
社区成员
341,723
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章