JavaWeb项目开发案例精粹-第4章博客网站系统-006View层
1.showAllArticle.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>博客系统首页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/main.css" media="all" />
<!--[if IE 6]><link type="text/css" rel="stylesheet" href="css/ie6.css" media="all" /><![endif]-->
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/site.js"></script>
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="scene"> c<img src="data:images/scene.jpg" alt="" />
<h1>博客网站系统</h1>
<div id="scale_area">
<div id="scale_knob">» Font Size «</div>
</div>
<div id="menu">
<div class="holder"> <a href="showAllArticle.action">博客首页</a> </div>
<div class="holder"> <a href="register.jsp">新博客注册</a> </div>
<div class="holder"> <a href="login.jsp">博客登录</a> </div>
</div>
</div>
<div id="content">
<div id="col_left">
<div class="post">
<div class="meta"><a class="title" href="">博客系统首页</a>
<div class="clear"></div>
</div>
<!-- 循环输出 -->
<s:iterator value="#request.all" id="art" status="sta">
<div class="comments">
<div class="comment">
<div class="meta"> <span><a href="user/showArticle.action?username=<s:property value='#art.username'/>&id=<s:property value='#art.id'/>"><s:property value="#art.title"/></a> <small>:</small></span>
<div class="clear"> </div>
</div>
</div>
<div class="comment alt">
<div class="meta"><span class="datetime">
<!-- 发表时间 -->
发表于:
<s:date name="#art.date"/>
<!-- 评论与点击数 -->
|评论(<s:property value="#request.critiqueCounts[#sta.index]"/>)|点击(<s:property value="#art.hasread"/>)|作者:<s:property value="#art.username"/>
</span>
<div class="clear"> </div>
</div>
</div>
</div>
</s:iterator>
<div class="comment" align="center">
当前第${page.currentPage}页,共${page.totalPage}页,每页显示${page.everyPage}条记录
<s:if test="#request.page.hasPrePage">
<a href="showAllArticle.action?currentPage=1">首页</a>
<a href="showAllArticle.action?currentPage=${page.currentPage -1 }">上一页</a>
</s:if>
<s:else>
首页
上一页
</s:else> <s:if test="#request.page.hasNextPage">
<a href="showAllArticle.action?currentPage=${page.currentPage + 1 }">下一页</a>
<a href="showAllArticle.action?currentPage=${page.totalPage }">尾页</a>
</s:if>
<s:else>
下一页
尾页
</s:else>
</div>
</div>
</div>
<div id="col_right">
<div id="search_box">
<form action="http://www.865171.cn/" method="post">
<div>
<input type="text" name="search" />
</div>
<div class="button_wrapper">
<input type="submit" value="Search" class="button" />
</div>
<div class="clear"> </div>
</form>
</div>
<div id="sidebar">
<h2>页面导航</h2>
<ul>
<li><a href="showAllArticle.action">博客首页</a></li>
<li><a href="register.jsp">新博客注册</a></li>
<li><a href="login.jsp">博客登录</a></li>
</ul>
</div>
</div>
<div class="clear"> </div>
</div>
<div id="footer">
<div class="clear"> </div>
<hr />
<p class="credit">博客网站系统</p>
</div>
</div>
</div>
</body>
</html>
2.login.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>博客系统登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/main.css" media="all" />
<!--[if IE 6]><link type="text/css" rel="stylesheet" href="css/ie6.css" media="all" /><![endif]-->
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/site.js"></script>
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="scene"> <img src="data:images/scene.jpg" alt="" />
<h1>博客网站系统</h1>
<div id="scale_area">
<div id="scale_knob">» Font Size «</div>
</div>
<div id="menu">
<div class="holder"> <a href="showAllArticle.action">博客首页</a> </div>
<div class="holder"> <a href="register.jsp">新博客注册</a> </div>
<div class="holder"> <a href="login.jsp">博客登录</a> </div>
</div>
</div>
<div id="content">
<div id="col_left">
<div class="post">
<div class="meta"></div>
<div class="comments"><div class="comment"></div>
<h2>博客登录</h2>
<form class="h" action="login.action" method="post">
<div>
<label>用户名:</label>
<input type="text" name="username" />
</div>
<div>
<label>密码:</label>
<input type="password" name="password" />
</div>
<div>
<label></label>
<div class="clear"> </div>
</div>
<div class="button_wrapper">
<input name="提交" type="submit" class="button" value="登录" />
</div>
</form>
</div>
</div>
</div>
<div id="col_right">
<div id="search_box">
<form action="" method="post">
<div>
<input type="text" name="search" />
</div>
<div class="button_wrapper">
<input type="submit" value="Search" class="button" />
</div>
<div class="clear"> </div>
</form>
</div>
<div id="sidebar">
<h2>页面导航</h2>
<ul>
<li><a href="showAllArticle.action">博客首页</a></li>
<li><a href="register.jsp">新博客注册</a></li>
<li><a href="login.jsp">博客登录</a></li>
</ul>
</div>
</div>
<div class="clear"> </div>
</div>
<div id="footer">
<div class="clear"> </div>
<hr />
<p class="credit">博客网站系统</p>
</div>
</div>
</div>
</body>
</html>
3.user/showAllUserArticle.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>我的全部文章</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../css/main.css" media="all" />
<!--[if IE 6]><link type="text/css" rel="stylesheet" href="css/ie6.css" media="all" /><![endif]-->
<script type="text/javascript" src="../js/mootools.js"></script>
<script type="text/javascript" src="../js/site.js"></script>
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="scene"> c<img src="../images/scene.jpg" alt="" />
<h1>${empty sessionScope.blogtitle ? "博客网站系统":sessionScope.blogtitle} <br/>
<font size="8">${empty sessionScope.idiograph ? "我的签名":sessionScope.idiograph}</font>
</h1>
<div id="scale_area">
<div id="scale_knob">» Font Size «</div>
</div>
<div id="menu">
<div class="holder"> <a href="../showAllArticle.action">博客首页</a> </div>
<div class="holder"> <a href="showUserAllArticle.action">用户首页</a> </div>
<div class="holder"> <a href="editbloginfo.jsp">个性化设置</a> </div>
<div class="holder"> <a href="addArticle.jsp">写日志</a> </div>
<div class="holder"> <a href="showPhoto.action">相册</a> </div>
</div>
</div>
<div id="content">
<div id="col_left">
<div class="post">
<div class="meta"><a class="title" href="">我的全部文章</a>
<div class="clear"></div>
</div>
<!-- 循环输出 -->
<s:iterator value="#request.all" id="art" status="sta">
<div class="comments">
<div class="comment">
<div class="meta"> <span><a href="showArticle.action?username=<s:property value='#art.username'/>&id=<s:property value='#art.id'/>"><s:property value="#art.title"/></a> <small>:</small></span>
<div class="clear"> </div>
</div>
</div>
<div class="comment alt">
<div class="meta"><span class="datetime">
<!-- 发表时间 -->
发表于:
<s:date name="#art.date"/>
<!-- 评论与点击数 -->
|评论(<s:property value="#request.critiqueCounts[#sta.index]"/>)|点击(<s:property value="#art.hasread"/>)
</span>
<div class="clear"> </div>
</div>
</div>
</div>
</s:iterator>
<div class="comment" align="center">
当前第${page.currentPage}页,共${page.totalPage}页,每页显示${page.everyPage}条记录
<s:if test="#request.page.hasPrePage">
<a href="showUserAllArticle.action?currentPage=1">首页</a>
<a href="showUserAllArticle.action?currentPage=${page.currentPage -1 }">上一页</a>
</s:if>
<s:else>
首页
上一页
</s:else> <s:if test="#request.page.hasNextPage">
<a href="showUserAllArticle.action?currentPage=${page.currentPage + 1 }">下一页</a>
<a href="showUserAllArticle.action?currentPage=${page.totalPage }">尾页</a>
</s:if>
<s:else>
下一页
尾页
</s:else>
</div>
</div>
</div>
<div id="col_right">
<div id="search_box">
<form action="" method="post">
<div>
<input type="text" name="search" />
</div>
<div class="button_wrapper">
<input type="submit" value="Search" class="button" />
</div>
<div class="clear"> </div>
</form>
</div>
<div id="sidebar">
<h2>页面导航</h2>
<ul>
<li><a href="../showAllArticle.action">博客首页</a></li>
<li><a href="showUserAllArticle.action">用户首页</a></li>
<li><a href="editbloginfo.jsp">个性化设置</a></li>
<li><a href="addArticle.jsp">写日志</a></li>
<li><a href="showPhoto.action">相册</a></li>
</ul>
</div>
</div>
<div class="clear"> </div>
</div>
<div id="footer">
<div class="clear"> </div>
<hr />
<p class="credit">博客网站系统</p>
</div>
</div>
</div>
</body>
</html>
4.site.js
var s = { start: function() {
s.ieDetect();
s.resizeCols();
s.setFont();
s.textScaler();
}, ieDetect: function() {
s.IEVersion = false;
var rv = -1;
if ( navigator.appName == 'Microsoft Internet Explorer' ) {
var ua = navigator.userAgent;
var re = new RegExp( "MSIE ([0-9]{1,}[\.0-9]{0,})" );
if ( re.exec( ua ) != null )
s.IEVersion = parseFloat( RegExp.$1 );
}
}, resizeCols: function() {
if( s.IEVersion != 6 ) {
var col_left = $( 'col_left' ).getStyle( 'height' ).toInt();
var col_right = $( 'col_right' ).getStyle( 'height' ).toInt();
if( col_left > col_right ) {
$( 'col_right' ).setStyle( 'height', ( ( col_left + 40 ) / 10 ) + 'em' );
}
if( col_right > col_left )
$( 'col_left' ).setStyle( 'height', ( col_right / 10 ) + 'em' );
}
}, setFont: function() {
if( Cookie.read( 'semfont' ) ) {
var size = Cookie.read( 'semfont' );
$( 'wrapper' ).setStyle( 'font-size', size + 'px' );
s.fontSize = size.toFloat();
}
else
s.fontSize = 10;
}, textScaler: function() {
var begin = ( s.fontSize == 10 ) ? 0 : ( s.fontSize - 10 ) * 10;
new Slider( $( 'scale_area' ), $( 'scale_knob' ), {
steps: 100,
onChange: function( pos ) {
var size = ( ( pos.toInt() / 10 ) + 10 );
$( 'wrapper' ).setStyle( 'font-size', size + 'px' );
},
onComplete: function( pos ) {
var size = ( ( pos.toInt() / 10 ) + 10 );
if( Cookie.read( 'semfont' ) )
Cookie.dispose( 'semfont' );
Cookie.write( 'semfont', size, { path: '/', duration: 28 } );
s.fontSize = size;
}
} ).set( begin );
}
} window.addEvent( 'domready', s.start );
5.user/showPhotos.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>相册</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../css/main.css" media="all" />
<!--[if IE 6]><link type="text/css" rel="stylesheet" href="css/ie6.css" media="all" /><![endif]-->
<script type="text/javascript" src="../js/mootools.js"></script>
<script type="text/javascript" src="../js/site.js"></script>
<script type="text/javascript">
var GB_ROOT_DIR = "./greybox/";
</script>
<script type="text/javascript" src="greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/gb_scripts.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="scene"> <img src="../images/scene.jpg" alt="" />
<h1>${empty sessionScope.blogtitle ? "博客网站系统":sessionScope.blogtitle} <br/>
<font size="8">${empty sessionScope.idiograph ? "我的签名":sessionScope.idiograph}</font>
</h1>
<div id="scale_area">
<div id="scale_knob">» Font Size «</div>
</div>
<div id="menu">
<div class="holder"> <a href="../showAllArticle.action">博客首页</a> </div>
<div class="holder"> <a href="showUserAllArticle.action">用户首页</a> </div>
<div class="holder"> <a href="editbloginfo.jsp">个性化设置</a> </div>
<div class="holder"> <a href="addArticle.jsp">写日志</a> </div>
<div class="holder"> <a href="showPhoto.action">相册</a> </div>
</div>
</div>
<div id="content">
<div id="col_left">
<div class="post">
<div class="meta"></div>
<div class="comments">
<h2>上传图片</h2>
<form action="photoUpload.action" method="post" enctype="multipart/form-data">
<div>
<label>选择要上传的图片:</label>
<input type="file" name="myFile"/>
</div>
<div>
<label></label>
<div class="clear"> </div>
</div>
<div class="button_wrapper">
<input name="提交" type="submit" class="button" value="上传" />
</div>
</form>
</div> <div class="comments">
<h2>显示相册图片</h2>
<table cellspacing="5" align="center" border="1">
<tr>
<s:iterator value="#request.photoList" id="photo" status="stu">
<td>
<a href='photo/${sessionScope.username}/<s:property value="photo"/>' title="我的相册" rel="gb_imageset[photos]">
<img src='photo/${sessionScope.username}/<s:property value="photo"/>' width="100" height="120">
</a>
</td>
<s:if test="(#stu.index + 1) % 3 == 0">
</tr>
<tr>
</s:if>
</s:iterator>
</table>
</div>
</div>
</div>
<div id="col_right">
<div id="search_box">
<form action="" method="post">
<div>
<input type="text" name="search" />
</div>
<div class="button_wrapper">
<input type="submit" value="Search" class="button" />
</div>
<div class="clear"> </div>
</form>
</div>
<div id="sidebar">
<h2>页面导航</h2>
<ul>
<li><a href="../showAllArticle.action">博客首页</a></li>
<li><a href="showUserAllArticle.action">用户首页</a></li>
<li><a href="editbloginfo.jsp">个性化设置</a></li>
<li><a href="addArticle.jsp">写日志</a></li>
<li><a href="showPhoto.action">相册</a></li>
</ul>
</div>
</div>
<div class="clear"> </div>
</div>
<div id="footer">
<div class="clear"> </div>
<hr />
<p class="credit">博客网站系统</p>
</div>
</div>
</div>
</body>
</html>
6.mainHeader.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
<!--
function mhEnter()
{
window.event.srcElement.className="lt1";
}
function mhLeave()
{
window.event.srcElement.className="lt0";
}
//-->
</script>
<link rel="stylesheet" href="../image/style.css">
</head> <body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr height="31">
<td background="image/line.jpg">
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<tr height="20" align="center">
<td width="278"> </td>
<td class="lt0" onmouseenter="mhEnter()" onmouseleave="mhLeave()"><a href="showAllArticle.action">博客首页</a></td>
<td class="ltsep">|</td>
<td class="lt0" onmouseenter="mhEnter()" onmouseleave="mhLeave()"><a href="register.jsp">新博客注册</a></td>
<td class="ltsep">|</td>
<td class="lt0" onmouseenter="mhEnter()" onmouseleave="mhLeave()"><a href="login.jsp">博客登陆</a></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
JavaWeb项目开发案例精粹-第4章博客网站系统-006View层的更多相关文章
- JavaWeb项目开发案例精粹-第4章博客网站系统-005action层
1. package com.sanqing.action; import java.util.Date; import java.util.Map; import com.opensymphony. ...
- JavaWeb项目开发案例精粹-第4章博客网站系统-004Service层
1. package com.sanqing.service; import java.util.List; import com.sanqing.fenye.Page; import com.san ...
- JavaWeb项目开发案例精粹-第4章博客网站系统-003Dao层
1. package com.sanqing.dao; import java.util.List; import com.sanqing.fenye.Page; import com.sanqing ...
- JavaWeb项目开发案例精粹-第4章博客网站系统-002辅助类及配置文件
1. <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5&qu ...
- JavaWeb项目开发案例精粹-第4章博客网站系统-001设计
1. 2. 3. # MySQL-Front 5.0 (Build 1.0) /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE */; /*!40101 SET SQL_MO ...
- JavaWeb项目开发案例精粹-第6章报价管理系统-05Action层
0. <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC &quo ...
- JavaWeb项目开发案例精粹-第6章报价管理系统-002辅助类及配置文件
1. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www ...
- JavaWeb项目开发案例精粹-第3章在线考试系统-007View层
0.login.jsp <%@ page language="java" import="java.util.*" pageEncoding=" ...
- JavaWeb项目开发案例精粹-第2章投票系统-001设计
1.项目结构 2.数据库设计 # MySQL-Front 5.0 (Build 1.0) /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE */; /*!40101 SET ...
随机推荐
- JNI文件中命名类与JAVA文件中匹配
jni.c中注册中 int register_android_boa(JNIEnv *env){ jclass clazz; static const char* const kClass ...
- 团队项目——NABC
N:根据自身遇到的问题,应对铁大环境——查询图书时只能登录网页进行查询,对于我们铁大莘莘学子着实是不方便的.所以此项目诞生. A:对于实现方法,首先我们随移动设备的潮流,做一个Android应用,对于 ...
- CS小分队第一阶段冲刺站立会议(5月9日)
昨日完成工作:对新子项目进行构思规划 遇到问题:不知道如何将excel表导入C#,对于timer控件不熟悉 今日计划:完成将存在EXCEL表中的名单导入,并进行抽号,熟悉timer控件
- 阴影 box-shadow(二)
阴影 box-shadow(二) 1.阴影模糊半径与阴影扩展半径的区别 阴影模糊半径:此参数可选,其值只能是为正值,如果其值为0时,表示阴影不具有模糊效果,其值越大阴影的边缘就越模糊: 阴影扩展半径: ...
- 微软Hololens学院教程-Hologram 220-空间声音(Spatial sound )【本文是老版本,与最新的微软教程有出入】
这是老版本的教程,为了不耽误大家的时间,请直接看原文,本文仅供参考哦! 原文链接https://developer.microsoft.com/EN-US/WINDOWS/HOLOGRAPHIC/ho ...
- Google Guava学习笔记——基础工具类String处理类的使用
不管你喜欢何种编程语言,很多时候针对string编程的处理都是乏味而且爱出错误的,很多时候,我们需要从文件或是数据库中读取数据,或者根据需求重新格式化或排序字符串给用户显示.幸运的是,Guava提供了 ...
- 第五周&第六周
学习进度表 周数 专业学习目标 学习时间 新增代码行 博客发表量 人文方面学习 知识总结 第四周 认真掌握老师上课所讲的内容,在课外多学习一些知识 5小时 50 1 阅读 ...
- hdu 4685 二分匹配+强连通分量
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4685 题解: 这一题是poj 1904的加强版,poj 1904王子和公主的人数是一样多的,并且给出 ...
- 【POJ】【1160】Post Office
DP/四边形不等式 邮局,经典的四边形不等式例题! 关于四边形不等式的学习请看 赵爽论文<动态规划加速原理之四边形不等式> 题目总结&题解:http://blog.csdn.net ...
- WPF 验证
WPF中TextBox的自动验证: 演示 : 用以下两个TextBox分别显示验证IP和非空值验证,先看效果: IP自动验证效果: 非空值自动验证效果: 第一步:定义TextBox验证的样式: < ...