经过长达将近三个小时的冲刺,我感觉身心俱疲,但它无法掩盖我敲代码的欲望!

  三个小时我只实现了公文流转系统的的部分功能。

  我深刻的意识到建民老师说的这套关系之复杂,它真的是太复杂了!!!没有系统的梳理,之前也没有系统地敲过这样一个程序,敲起来感到十分的头大!

  期末考试感觉压力很大!

  这部分是部门写邮件的代码,这部分我卡的是转码的问题,url传值出现了问题,最新版本的tomcat并不支持其他字符,需要转码

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
#d1{
text-align: center;
padding-top: 40px;
font-family: "微软雅黑";
font-size: 40px;
background-color: #DDDDDD;
height: 100px;
}
div ul{
vertical-align: top;
list-style-type: none;
margin: 0px;
vertical-align: left;
width: 200px;
padding: 0px;
border-top: 20px solid #F8A0E7;
border-bottom :20px solid #F8A0E7;
}
.headd{
font-family: "微软雅黑";
lighting-color: red;
font-size: 20px;
}
div li a{
height: 80px;
display: block;
padding: 0px 0px 0px 0em;
text-decoration: none;
border-left: 20px solid pink;
}
div li a:link,div li a:visited{
background-color: #F0F0F0;
color: #461737;
}
div li a:hover{
background-color: green;
color: gray;
}
div li a:active{
background-color: pink;
}
#left{
float:left;
}
#right{
height:400px;
width:120px;
float:left;
border:1px solid green;
}
#inp{
float:left;
height:400px;
width:1202px;
}
.btn{
float:left;
}
</style>
<script type="text/javascript">
//function Onload(){
// var s="<%=request.getParameter("message")%>";
// if (s !== null || s !== undefined ||s !== '') {
// alert(s);
// }
//}
function Out(){
var title=document.getElementById("title").value;
if(title=="") {
alert("标题不能为空!!!");
return false;
}
var text=encodeURIComponent(document.getElementById("inp").value);
var s="SaveAritical?text="+text+"&type=Document&title="+encodeURIComponent(title);
window.location.href=s;
}
function Save(){
var title=document.getElementById("title").value;
if(title=="") {
alert("标题不能为空!!!");
return false;
}
var text=encodeURIComponent(document.getElementById("inp").value);
var s="OutAritical?text="+text+"&type=Document&title="+encodeURIComponent(title);
window.location.href=s;
} </script>
</head>
<body onload="Onload()">
<div id="d1">Aritical Of Department</div>
<div id="left">
<ul>
<li class="headd"><a href="#" onclick="fresh()">Refresh</a></li>
<li><a href="Document.jsp">公文拟制</a></li>
<li><a href="Receive?type=Document">签收公文</a></li>
<li><a href="DocumentView.jsp">浏览公文</a></li>
</ul>
</div>
<div id="right">
<div><textarea type="text" id="title" placeholder="输入标题"> </textarea></div>
<div ><textarea type="text" id="inp" placeholder="输入内容"> </textarea></div>
<div><button class="btn" onclick="Save()">保存</button></div>
<div><button class="btn" onclick="Out()">发布</button></div> </div>
</body>
</html>

这部分是保存 html:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
#d1{
text-align: center;
padding-top: 40px;
font-family: "微软雅黑";
font-size: 40px;
background-color: #DDDDDD;
height: 100px;
}
div ul{
vertical-align: top;
list-style-type: none;
margin: 0px;
vertical-align: left;
width: 200px;
padding: 0px;
border-top: 20px solid #F8A0E7;
border-bottom :20px solid #F8A0E7;
}
.headd{
font-family: "微软雅黑";
lighting-color: red;
font-size: 20px;
}
div li a{
height: 80px;
display: block;
padding: 0px 0px 0px 0em;
text-decoration: none;
border-left: 20px solid pink;
}
div li a:link,div li a:visited{
background-color: #F0F0F0;
color: #461737;
}
div li a:hover{
background-color: green;
color: gray;
}
div li a:active{
background-color: pink;
}
#left{
float:left;
}
#right{
height:400px;
width:120px;
float:left;
border:1px solid green;
}
#inp{
float:left;
height:400px;
width:1202px;
}
.btn{
float:left;
}
</style>
<script type="text/javascript">
function Onload(){
alert("发布成功!");
}
function Out(){
var title=document.getElementById("title").value;
if(title=="") {
alert("标题不能为空!!!");
return false;
}
var text=encodeURIComponent(document.getElementById("inp").value);
var s="OutAritical?text="+text+"&type=Document&title="+title;
window.location.href=s;
}
function Save(){
var title=document.getElementById("title").value;
if(title=="") {
alert("标题不能为空!!!");
return false;
}
var text=encodeURIComponent(document.getElementById("inp").value);
var s="SaveAritical?text="+text+"&type=Document&title="+title;
window.location.href=s;
} </script>
</head>
<body onload="Onload()">
<div id="d1">Aritical Of Department</div>
<div id="left">
<ul>
<li class="headd"><a href="#" onclick="fresh()">Refresh</a></li>
<li><a href="Produce.jsp">公文拟制</a></li>
<li><a href="Receive.jsp">签收公文</a></li>
<li><a href="View.jsp">浏览公文</a></li>
</ul>
</div>
<div id="right">
<div><textarea type="text" id="title" placeholder="输入标题"> </textarea></div>
<div ><textarea type="text" id="inp" placeholder="输入内容"> </textarea></div>
<div><button class="btn" onclick="Save()">保存</button></div>
<div><button class="btn" onclick="Out()">发布</button></div> </div>
</body>
</html>

servlet:

package com.Aritical.servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/SaveAritical")
public class SaveAritical extends HttpServlet {
private static final long serialVersionUID = 1L;
public SaveAritical() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String text=request.getParameter("text");
String type=request.getParameter("type");
String title=request.getParameter("title");
Link l=new Link();
try {
int id=0;
Connection con=l.lin("AriticalManager");
Statement stmt=con.createStatement();
String queryid="select * from Aritical_"+type;
ResultSet rsst=stmt.executeQuery(queryid);
while(rsst.next()) {
id=Integer.parseInt(rsst.getString("id"));
}
rsst.close();
id++;
String s="insert into Aritical values("+id+",1,'"+title+"','"+text+"')";
stmt.executeUpdate(s);
stmt.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String url=type+"Out.jsp";
request.getRequestDispatcher(url).forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
} }

这是servlet:

package com.Aritical.servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/OutAritical")
public class OutAritical extends HttpServlet {
private static final long serialVersionUID = 1L;
public OutAritical() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String text=request.getParameter("text");
String type=request.getParameter("type");
String title=request.getParameter("title");
Link l=new Link();
try {
int id=0;
Connection con=l.lin("AriticalManager");
Statement stmt=con.createStatement();
String queryid="select * from Aritical_"+type;
ResultSet rsst=stmt.executeQuery(queryid);
while(rsst.next()) {
id=Integer.parseInt(rsst.getString("id"));
}
rsst.close();
id++;
String s="insert into Aritical_"+type+" values("+id+",0,'"+title+"','"+text+"')";
stmt.executeUpdate(s);
stmt.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String url=type+"Save.jsp";
request.getRequestDispatcher(url).forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
} }

这部分是发布的代码

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
#d1{
text-align: center;
padding-top: 40px;
font-family: "微软雅黑";
font-size: 40px;
background-color: #DDDDDD;
height: 100px;
}
div ul{
vertical-align: top;
list-style-type: none;
margin: 0px;
vertical-align: left;
width: 200px;
padding: 0px;
border-top: 20px solid #F8A0E7;
border-bottom :20px solid #F8A0E7;
}
.headd{
font-family: "微软雅黑";
lighting-color: red;
font-size: 20px;
}
div li a{
height: 80px;
display: block;
padding: 0px 0px 0px 0em;
text-decoration: none;
border-left: 20px solid pink;
}
div li a:link,div li a:visited{
background-color: #F0F0F0;
color: #461737;
}
div li a:hover{
background-color: green;
color: gray;
}
div li a:active{
background-color: pink;
}
#left{
float:left;
}
#right{
height:400px;
width:120px;
float:left;
border:1px solid green;
}
#inp{
float:left;
height:400px;
width:1202px;
}
.btn{
float:left;
}
</style>
<script type="text/javascript">
function Onload(){
alert("发布成功!");
}
function Out(){
var title=document.getElementById("title").value;
if(title=="") {
alert("标题不能为空!!!");
return false;
}
var text=encodeURIComponent(document.getElementById("inp").value);
var s="OutAritical?text="+text+"&type=Document&title="+title;
window.location.href=s;
}
function Save(){
var title=document.getElementById("title").value;
if(title=="") {
alert("标题不能为空!!!");
return false;
}
var text=encodeURIComponent(document.getElementById("inp").value);
var s="SaveAritical?text="+text+"&type=Document&title="+title;
window.location.href=s;
} </script>
</head>
<body onload="Onload()">
<div id="d1">Aritical Of Department</div>
<div id="left">
<ul>
<li class="headd"><a href="#" onclick="fresh()">Refresh</a></li>
<li><a href="Produce.jsp">公文拟制</a></li>
<li><a href="Receive.jsp">签收公文</a></li>
<li><a href="View.jsp">浏览公文</a></li>
</ul>
</div>
<div id="right">
<div><textarea type="text" id="title" placeholder="输入标题"> </textarea></div>
<div ><textarea type="text" id="inp" placeholder="输入内容"> </textarea></div>
<div><button class="btn" onclick="Save()">保存</button></div>
<div><button class="btn" onclick="Out()">发布</button></div> </div>
</body>
</html>

这是发布的servlet:

package com.Aritical.servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/SaveAritical")
public class SaveAritical extends HttpServlet {
private static final long serialVersionUID = 1L;
public SaveAritical() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String text=request.getParameter("text");
String type=request.getParameter("type");
String title=request.getParameter("title");
Link l=new Link();
try {
int id=0;
Connection con=l.lin("AriticalManager");
Statement stmt=con.createStatement();
String queryid="select * from Aritical_"+type;
ResultSet rsst=stmt.executeQuery(queryid);
while(rsst.next()) {
id=Integer.parseInt(rsst.getString("id"));
}
rsst.close();
id++;
String s="insert into Aritical values("+id+",1,'"+title+"','"+text+"')";
stmt.executeUpdate(s);
stmt.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String url=type+"Out.jsp";
request.getRequestDispatcher(url).forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
} }

签收:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DocumentReceive</title>
<style type="text/css">
#d1{
text-align: center;
padding-top: 40px;
font-family: "微软雅黑";
font-size: 40px;
background-color: #DDDDDD;
height: 100px;
}
div ul{
vertical-align: top;
list-style-type: none;
margin: 0px;
vertical-align: left;
width: 200px;
padding: 0px;
border-top: 20px solid #F8A0E7;
border-bottom :20px solid #F8A0E7;
}
.headd{
font-family: "微软雅黑";
lighting-color: red;
font-size: 20px;
}
div li a{
height: 80px;
display: block;
padding: 0px 0px 0px 0em;
text-decoration: none;
border-left: 20px solid pink;
}
div li a:link,div li a:visited{
background-color: #F0F0F0;
color: #461737;
}
div li a:hover{
background-color: green;
color: gray;
}
div li a:active{
background-color: pink;
}
#left{
float:left;
}
#right{
height:400px;
width:120px;
float:left;
border:1px solid green;
}
#inp{
float:left;
height:400px;
width:1202px;
}
.btn{
float:left;
}
</style>
<script type="text/javascript">
function receive(){ }
</script>
</head>
<body>
<div id="d1">Aritical Of Department</div>
<div id="left">
<ul>
<li class="headd"><a href="#" onclick="fresh()">Refresh</a></li>
<li><a href="Document.jsp">公文拟制</a></li>
<li><a href="Receive?type=Document">签收公文</a></li>
<li><a href="DocumentView.jsp">浏览公文</a></li>
</ul>
</div>
<div id="right">
<table>
<c:forEach items="${list}" var="list" >
<tr>
<td onmouseover="this.style.backgroundColor='#FCADEC';"
onmouseout="this.style.backgroundColor='#d4e3e5';">${list.id}</td>
<td onmouseover="this.style.backgroundColor='#FCADEC';"
onmouseout="this.style.backgroundColor='#d4e3e5';">${list.state}</td>
<td onmouseover="this.style.backgroundColor='#FCADEC';"
onmouseout="this.style.backgroundColor='#d4e3e5';">${list.title}</td>
</tr>
<button onclick="receive()">签收</button>
</c:forEach>
</table>
</div>
</body>
</html>

这部分还没完善servlet:

package com.Aritical.servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList; import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; /**
* Servlet implementation class Receive
*/
@WebServlet("/Receive")
public class Receive extends HttpServlet {
private static final long serialVersionUID = 1L;
public Receive() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String type=request.getParameter("type");
int min=0,max=0;
ArrayList<AriticalBean> arr=new ArrayList<AriticalBean>();
switch (type) {
case "Document":
{ min=1;
max=4;
break;
}
default:
break;
}
Link l=new Link();
try {
Connection con=l.lin("AriticalManager");
Statement stmt=con.createStatement();
String s="select * from Aritical where id between "+min+" and "+max;
ResultSet rsst=stmt.executeQuery(s);
while(rsst.next()) {
AriticalBean ab=new AriticalBean();
ab.setId(rsst.getInt("id"));
ab.setState(rsst.getInt("state"));
ab.setTitle(rsst.getString("title"));
ab.setText(rsst.getString("text"));
arr.add(ab);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
request.setAttribute("list", arr);
String s=type+"Receive.jsp";
request.getRequestDispatcher(s).forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
} }

目前只写出了这么点,稍后会完善并进行深度总结!

Java期末考试冲刺总结的更多相关文章

  1. java 期末考试复习

      //Scanner这样写? Scanner input = new Scanner(System.in); //不断获得下一个单词 names[i] = toTitleCase(input.nex ...

  2. java期末考试

    水仙花数 package txt; public class shuixianhua { public static void main(String[] args) { // TODO Auto-g ...

  3. Java期末考试编程题复习

    在程序中定义Person类,为该类编写如下字段.构造器.访问器.修改器和相应的其他方法.(20分) <1>在Person类中定义两个字段: 私有访问权限,类型为String的name字段: ...

  4. Java 期末考试

    一: 题目:打印出100-999之间所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身.   例如:153是一个"水仙花 ...

  5. JAVA期末考试整理

    Technical problem: 0.read: Scanner input= new Scanner(System.in) random#: x=(int)(Math.random()*10) ...

  6. Java开发工程师(Web方向) - 03.数据库开发 - 期末考试

    期末考试 编程题 本编程题包含4个小题,覆盖知识点从基础的JDBC.连接池到MyBatis. 1(10分) 有一款在线教育产品“天天向上”主要实现了在手机上查看课程表的功能.该产品的后端系统有一张保存 ...

  7. 中国MOOC_面向对象程序设计——Java语言_期末考试编程题_1细胞自动机

    期末考试编程题 返回   这是期末考试的编程题 温馨提示: 1.本次考试属于Online Judge题目,提交后由系统即时判分. 2.学生可以在考试截止时间之前提交答案,系统将取其中的最高分作为最终成 ...

  8. 中国MOOC_零基础学Java语言_期末考试的编程题_1二进制的前导的零

    期末考试的编程题 返回   这是期末考试的编程题,在60分钟内,你可以多次提交,直到正确为止. 温馨提示: 1.本次考试属于Online Judge题目,提交后由系统即时判分. 2.学生可以在考试截止 ...

  9. 复旦大学2015--2016学年第二学期高等代数II期末考试情况分析

    一.期末考试成绩班级前几名 胡晓波(90).杨彦婷(88).宋卓卿(85).唐指朝(84).陈建兵(83).宋沛颖(82).王昊越(81).白睿(80).韩沅伯(80).王艺楷(80).张漠林(80) ...

随机推荐

  1. UWP App国际化的两种实现

    开发App,我们都会标配简体中文和英文两种语言.至于你加多少种,取决于你的客户市场.无论如何,英语是必不可少的. UWP平台里面,微软也提供了一种默认的国际化方案,即修改Resources.resw资 ...

  2. C#设计模式学习笔记:(19)策略模式

    本笔记摘抄自:https://www.cnblogs.com/PatrickLiu/p/8057654.html,记录一下学习过程以备后续查用. 一.引言 今天我们要讲行为型设计模式的第七个模式--策 ...

  3. mysql中EXPLAIN 的作用

    (一)id列: (1).id 相同执行顺序由上到下 mysql> explain -> SELECT*FROM tb_order tb1 -> LEFT JOIN tb_produc ...

  4. sklearn使用小贴士

    1 sklearn简介 Scikit-learn(sklearn)是机器学习中的第三方模块,封装了常用的机器学习算法,涉及回归.降维.分类以及聚类等,提供python接口. 虽然sklearn容纳的算 ...

  5. JS简易计算器的实现,以及代码的优化

    用JS实现简易计算器 首先创建结构和样式 <!DOCTYPE html> <html lang="en"> <head> <meta ch ...

  6. python部署到服务器

    python部署到服务器 linux下的CentOS 7 自带python2.7.5, 使用 python --version 命令查看,因系统需要python2.7.5,因此我们并不卸载,另外安装p ...

  7. javascript单词

    abstract n. 摘要,抽象的东西 adj. 抽象的,理论的 vt. 移除,摘要,偷 vi. 做摘要 do aux. 助动词(无词意) v. 干,做 if conj. 如果,是否,即使 n. 条 ...

  8. excel 名次

    RANK.AVG 函数 全部显示 全部隐藏 返回一个数字在数字列表中的排位:数字的排位是其大小与列表中其他值的比值:如果多个值具有相同的排位,则将返回平均排位. 语法 RANK.AVG(number, ...

  9. 浅谈python的第三方库——numpy(终)

    本文作为numpy系列的总结篇,继续介绍numpy中常见的使用小贴士 1 手动转换矩阵规格 转换矩阵规格,就是在保持原矩阵的元素数量和内容不变的情况下,改变原矩阵的行列数目.比如,在得到一个5x4的矩 ...

  10. Linux进程间通信-管道深入理解(转)

    原文地址:https://www.linuxidc.com/Linux/2018-04/151680.htm Linux进程通信系列文章将详细介绍各种通信方式的机制和区别 1.进程间通信 每个进程各自 ...