修复论坛空白输入,上传文件未完成

This commit is contained in:
FJY
2017-11-18 20:28:08 +08:00
parent 6ed6a77b0e
commit a303f56e12
47 changed files with 1699 additions and 615 deletions

View File

@@ -13,5 +13,10 @@
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="com.genuitec.runtime.library/com.genuitec.jstl_1.2.2">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/> <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath> </classpath>

6
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/xz1_v1.1.iml" filepath="$PROJECT_DIR$/xz1_v1.1.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="L:/git_warehouse/IDEA" vcs="Git" />
</component>
</project>

264
.idea/workspace.xml generated Normal file
View File

@@ -0,0 +1,264 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c568b069-92f2-4eca-8512-588b9048b08e" name="Default" comment="" />
<ignored path="$PROJECT_DIR$/WebRoot/WEB-INF/classes/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="index.html" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/WebRoot/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="513">
<caret line="45" column="40" lean-forward="false" selection-start-line="45" selection-start-column="40" selection-end-line="45" selection-end-column="40" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="L:/git_warehouse/IDEA" />
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="260" />
<option name="y" value="20" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="AndroidView" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="xz1_v1.1" type="b2602c69:ProjectViewProjectNode" />
<item name="xz1_v1.1" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="settings.editor.selected.configurable" value="vcs.Git" />
<property name="last_opened_file_path" value="L:/git_warehouse/IDEA" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="Applet" factoryName="Applet">
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<module />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="c568b069-92f2-4eca-8512-588b9048b08e" name="Default" comment="" />
<created>1510580426920</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1510580426920</updated>
<workItem from="1510580433862" duration="2121000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2121000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18020834" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/WebRoot/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="513">
<caret line="45" column="40" lean-forward="false" selection-start-line="45" selection-start-column="40" selection-end-line="45" selection-end-column="40" />
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@@ -1,2 +1,3 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//WebRoot/module/limits_check.jsp=UTF-8 encoding//WebRoot/module/limits_check.jsp=UTF-8
encoding//WebRoot/send.jsp=UTF-8

View File

@@ -0,0 +1,87 @@
<%@ page language="java" import="java.sql.*"
contentType="text/html;charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>检验插入页面</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>
<br>
<%
boolean flag = false;
request.setCharacterEncoding("utf-8");
String viewport = request.getParameter("viewport");
String add_admin = request.getParameter("add_admin");
String empid = request.getParameter("empid");
String empjob = request.getParameter("empjob");
String empname = request.getParameter("empname");
String empsex = request.getParameter("empsex");
String empnation = request.getParameter("empnation");
String empnative = request.getParameter("empnative");
String empschool = request.getParameter("empschool");
String empdept = request.getParameter("empdept");
String empmajor = request.getParameter("empmajor");
String empbirthday = request.getParameter("empbirthday");
String empQQ = request.getParameter("empQQ");
String empemail = request.getParameter("empemail");
String empPhoneNum = request.getParameter("empPhoneNum");
String empadress = request.getParameter("empadress");
String empResume = request.getParameter("empResume");
String empremark = request.getParameter("empremark");
%>
<%
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8";
String use = "root";
String password = "";
Class.forName(driver);
try {
Connection conn = DriverManager.getConnection(url, use, password);
PreparedStatement sql = conn.prepareStatement(
"insert into adminstrator_record(AdminNo,AdminName,Adminsex,Adminjob)values(?,?,?,?)");
sql.setString(1, adminNo);
sql.setString(2, name);
sql.setString(3, adminsex);
sql.setString(4, adminjob);
int rtn = sql.executeUpdate();
if (rtn != 0) {
flag = true;
}
sql.close();
conn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
%>
<!-- 判断是否是插入成功 -->
<%
if (flag == true) {
%>
<jsp:forward page="insert_success.jsp" />
<%
} else if (flag == false) {
%>
<jsp:forward page="insert_success.jsp" />
<%
}
%>
</body>
</html>

View File

@@ -6,6 +6,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
<%@page import="java.sql.Connection"%> <%@page import="java.sql.Connection"%>
<%@page import="java.sql.*"%> <%@page import="java.sql.*"%>
<%@page import="java.sql.DriverManager"%> <%@page import="java.sql.DriverManager"%>
<%@ page import="com.wgh.MySqlconn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
@@ -68,6 +69,7 @@ String str_date2 = currentTime.toString(); //将Date型日期时间转换成字
try { try {
Connection conn = null; Connection conn = null;
PreparedStatement sql = null; PreparedStatement sql = null;
conn = DriverManager.getConnection(url, user, password);
sql = conn.prepareStatement("update counter set visitCount=visitCount+1"); sql = conn.prepareStatement("update counter set visitCount=visitCount+1");
int rtn = sql.executeUpdate(); int rtn = sql.executeUpdate();
sql.close(); sql.close();
@@ -78,6 +80,7 @@ String str_date2 = currentTime.toString(); //将Date型日期时间转换成字
try { try {
Connection conn = null; Connection conn = null;
PreparedStatement sql = null; PreparedStatement sql = null;
conn = DriverManager.getConnection(url, user, password);
sql = conn.prepareStatement("insert into iplist(IP,times,userName)values(?,?,?)"); sql = conn.prepareStatement("insert into iplist(IP,times,userName)values(?,?,?)");
sql.setString(1, counter); sql.setString(1, counter);
sql.setString(2, str_date1); sql.setString(2, str_date1);

Binary file not shown.

View File

@@ -9,4 +9,13 @@
<welcome-file>default.htm</welcome-file> <welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file> <welcome-file>default.jsp</welcome-file>
</welcome-file-list> </welcome-file-list>
<servlet>
<servlet-name>UploadHandleServlet</servlet-name>
<servlet-class>me.gacl.web.controller.UploadHandleServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UploadHandleServlet</servlet-name>
<url-pattern>/servlet/UploadHandleServlet</url-pattern>
</servlet-mapping>
</web-app> </web-app>

157
WebRoot/add_docFile.jsp Normal file
View File

@@ -0,0 +1,157 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.*"%>
<%@page import="java.sql.DriverManager"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>学生管理</title>
<link rel="stylesheet" href="css/manage.css" type="text/css">
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="css/footer.css" type="text/css">
<script src="js/ie-emulation-modes-warning.js"></script>
</head>
<body>
<%@ include file="/module/top.jsp"%>
<%@ include file="/module/limits_check.jsp"%>
<div class="container">
<%
if (session.getAttribute("actualuser") == null) {
out.println("<script>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html';</script>");
return;
}
Object actualuser = session.getAttribute("actualuser");
%>
<div class="row">
<%@ include file="module/sidebar.jsp"%>
<div class="col-lg-1 col-md-1 hidden-xs"></div>
<div class="col-sm-12 col-lg-9 col-md-9 table-responsive"
align="center">
<h3 class="text-center">添加档案</h3>
<form class="form-horizontal" role="form" id="add_docFile"
name="add_docFile" action="JSPhandle/docFile_insert.jsp" method="post">
<table class="table table-bordered">
<tr>
<td colspan="7"><b>个人档案</b>
<button type="submit" class="btn btn-success pull-right btn-sm">提交</button></td>
</tr>
<tr>
<td>工号</td>
<td><input class="form-control" type="text" name="empid"></td>
<td>职务</td>
<td><select class="form-control" name="empjob">
<%
String driverClass = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8";
String user = "root";
String password = "";
Class.forName(driverClass);
try {
ResultSet rs = null;
Connection conn = null;
PreparedStatement sql = null;
conn = DriverManager.getConnection(url, user, password);
Statement stmt = conn.createStatement();
sql = conn.prepareStatement("select * from administrator_job");
rs = sql.executeQuery();
while (rs.next()) {
%>
<option value="<%=rs.getString("AdminJob")%>"><%=rs.getString("AdminJob")%></option>
<%
}
sql.close();
rs.close();
conn.close();
stmt.close();
} catch (Exception ex) {
ex.printStackTrace();
}
%>
<%
%>
</select></td>
<td rowspan="5"><input type="file"></td>
</tr>
<tr>
<td>姓名</td>
<td><input class="form-control" type="text" name="empname"></td>
<td>性别</td>
<td><select class="form-control" name="empsex">
<option>男</option>
<option>女</option>
</select></td>
</tr>
<!--第二行-->
<tr>
<td>民族</td>
<td><input class="form-control" type="text" name="empnation"></td>
<td>籍贯</td>
<td><input class="form-control" type="text" name="empnative"></td>
</tr>
<!--第三行-->
<!--第四行-->
<tr>
<td>学校</td>
<td><input class="form-control" type="text" name="empschool" value="广东财经大学"></td>
<td>学院</td>
<td><input class="form-control" type="text" name="empdept"></td>
</tr>
<tr>
<td>专业</td>
<td><input class="form-control" type="text" name="empmajor"></td>
<td>出生年月</td>
<td><input class="form-control" type="text" name="empbirthday"></td>
</tr>
<tr>
<td colspan="7"><b>社交信息</b></td>
</tr>
<tr>
<td>QQ</td>
<td colspan="0"><input class="form-control" type="text" name="empQQ"></td>
<td>邮箱</td>
<td colspan="2"><input class="form-control" type="text" name="empemail"></td>
</tr>
<tr>
<td>电话</td>
<td colspan="0"><input class="form-control" type="text" name="empPhoneNum"></td>
<td>住址</td>
<td colspan="2"><input class="form-control" type="text" name="empadress"></td>
</tr>
<tr>
<td colspan="7"><b>简历</b></td>
</tr>
<tr>
<td colspan="7"><textarea class="form-control" cols="100%"
rows="10" name="empResume"></textarea></td>
</tr>
<tr>
<td colspan="7"><b>备注</b></td>
</tr>
<tr>
<td colspan="7"><textarea class="form-control" cols="100%"
rows="10" name="empremark"></textarea></td>
</tr>
</table>
</form>
</div>
</div>
<!-- Footer -->
<%@ include file="module/footer.jsp"%>
<!-- //Footer -->
</div>
<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,6 +1,6 @@
/*! /*!
* Bootstrap v3.3.5 (http://getbootstrap.com) * Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc. * Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/ */
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
@@ -279,10 +279,10 @@ th {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.glyphicon-asterisk:before { .glyphicon-asterisk:before {
content: "\2a"; content: "\002a";
} }
.glyphicon-plus:before { .glyphicon-plus:before {
content: "\2b"; content: "\002b";
} }
.glyphicon-euro:before, .glyphicon-euro:before,
.glyphicon-eur:before { .glyphicon-eur:before {
@@ -1106,7 +1106,6 @@ a:focus {
text-decoration: underline; text-decoration: underline;
} }
a:focus { a:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color; outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; outline-offset: -2px;
} }
@@ -2537,7 +2536,6 @@ select[size] {
input[type="file"]:focus, input[type="file"]:focus,
input[type="radio"]:focus, input[type="radio"]:focus,
input[type="checkbox"]:focus { input[type="checkbox"]:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color; outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; outline-offset: -2px;
} }
@@ -2582,6 +2580,10 @@ output {
.form-control::-webkit-input-placeholder { .form-control::-webkit-input-placeholder {
color: #999; color: #999;
} }
.form-control::-ms-expand {
background-color: transparent;
border: 0;
}
.form-control[disabled], .form-control[disabled],
.form-control[readonly], .form-control[readonly],
fieldset[disabled] .form-control { fieldset[disabled] .form-control {
@@ -2988,7 +2990,7 @@ select[multiple].input-lg {
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.form-horizontal .form-group-lg .control-label { .form-horizontal .form-group-lg .control-label {
padding-top: 14.333333px; padding-top: 11px;
font-size: 18px; font-size: 18px;
} }
} }
@@ -3025,7 +3027,6 @@ select[multiple].input-lg {
.btn.focus, .btn.focus,
.btn:active.focus, .btn:active.focus,
.btn.active.focus { .btn.active.focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color; outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; outline-offset: -2px;
} }
@@ -3096,9 +3097,6 @@ fieldset[disabled] a.btn {
.open > .dropdown-toggle.btn-default { .open > .dropdown-toggle.btn-default {
background-image: none; background-image: none;
} }
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover, .btn-default.disabled:hover,
.btn-default[disabled]:hover, .btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover, fieldset[disabled] .btn-default:hover,
@@ -3107,13 +3105,7 @@ fieldset[disabled] .btn-default:hover,
fieldset[disabled] .btn-default:focus, fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus, .btn-default.disabled.focus,
.btn-default[disabled].focus, .btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus, fieldset[disabled] .btn-default.focus {
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
background-color: #fff; background-color: #fff;
border-color: #ccc; border-color: #ccc;
} }
@@ -3162,9 +3154,6 @@ fieldset[disabled] .btn-default.active {
.open > .dropdown-toggle.btn-primary { .open > .dropdown-toggle.btn-primary {
background-image: none; background-image: none;
} }
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover, .btn-primary.disabled:hover,
.btn-primary[disabled]:hover, .btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover, fieldset[disabled] .btn-primary:hover,
@@ -3173,13 +3162,7 @@ fieldset[disabled] .btn-primary:hover,
fieldset[disabled] .btn-primary:focus, fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus, .btn-primary.disabled.focus,
.btn-primary[disabled].focus, .btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus, fieldset[disabled] .btn-primary.focus {
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
background-color: #337ab7; background-color: #337ab7;
border-color: #2e6da4; border-color: #2e6da4;
} }
@@ -3228,9 +3211,6 @@ fieldset[disabled] .btn-primary.active {
.open > .dropdown-toggle.btn-success { .open > .dropdown-toggle.btn-success {
background-image: none; background-image: none;
} }
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover, .btn-success.disabled:hover,
.btn-success[disabled]:hover, .btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover, fieldset[disabled] .btn-success:hover,
@@ -3239,13 +3219,7 @@ fieldset[disabled] .btn-success:hover,
fieldset[disabled] .btn-success:focus, fieldset[disabled] .btn-success:focus,
.btn-success.disabled.focus, .btn-success.disabled.focus,
.btn-success[disabled].focus, .btn-success[disabled].focus,
fieldset[disabled] .btn-success.focus, fieldset[disabled] .btn-success.focus {
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
background-color: #5cb85c; background-color: #5cb85c;
border-color: #4cae4c; border-color: #4cae4c;
} }
@@ -3294,9 +3268,6 @@ fieldset[disabled] .btn-success.active {
.open > .dropdown-toggle.btn-info { .open > .dropdown-toggle.btn-info {
background-image: none; background-image: none;
} }
.btn-info.disabled,
.btn-info[disabled],
fieldset[disabled] .btn-info,
.btn-info.disabled:hover, .btn-info.disabled:hover,
.btn-info[disabled]:hover, .btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover, fieldset[disabled] .btn-info:hover,
@@ -3305,13 +3276,7 @@ fieldset[disabled] .btn-info:hover,
fieldset[disabled] .btn-info:focus, fieldset[disabled] .btn-info:focus,
.btn-info.disabled.focus, .btn-info.disabled.focus,
.btn-info[disabled].focus, .btn-info[disabled].focus,
fieldset[disabled] .btn-info.focus, fieldset[disabled] .btn-info.focus {
.btn-info.disabled:active,
.btn-info[disabled]:active,
fieldset[disabled] .btn-info:active,
.btn-info.disabled.active,
.btn-info[disabled].active,
fieldset[disabled] .btn-info.active {
background-color: #5bc0de; background-color: #5bc0de;
border-color: #46b8da; border-color: #46b8da;
} }
@@ -3360,9 +3325,6 @@ fieldset[disabled] .btn-info.active {
.open > .dropdown-toggle.btn-warning { .open > .dropdown-toggle.btn-warning {
background-image: none; background-image: none;
} }
.btn-warning.disabled,
.btn-warning[disabled],
fieldset[disabled] .btn-warning,
.btn-warning.disabled:hover, .btn-warning.disabled:hover,
.btn-warning[disabled]:hover, .btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover, fieldset[disabled] .btn-warning:hover,
@@ -3371,13 +3333,7 @@ fieldset[disabled] .btn-warning:hover,
fieldset[disabled] .btn-warning:focus, fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled.focus, .btn-warning.disabled.focus,
.btn-warning[disabled].focus, .btn-warning[disabled].focus,
fieldset[disabled] .btn-warning.focus, fieldset[disabled] .btn-warning.focus {
.btn-warning.disabled:active,
.btn-warning[disabled]:active,
fieldset[disabled] .btn-warning:active,
.btn-warning.disabled.active,
.btn-warning[disabled].active,
fieldset[disabled] .btn-warning.active {
background-color: #f0ad4e; background-color: #f0ad4e;
border-color: #eea236; border-color: #eea236;
} }
@@ -3426,9 +3382,6 @@ fieldset[disabled] .btn-warning.active {
.open > .dropdown-toggle.btn-danger { .open > .dropdown-toggle.btn-danger {
background-image: none; background-image: none;
} }
.btn-danger.disabled,
.btn-danger[disabled],
fieldset[disabled] .btn-danger,
.btn-danger.disabled:hover, .btn-danger.disabled:hover,
.btn-danger[disabled]:hover, .btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover, fieldset[disabled] .btn-danger:hover,
@@ -3437,13 +3390,7 @@ fieldset[disabled] .btn-danger:hover,
fieldset[disabled] .btn-danger:focus, fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled.focus, .btn-danger.disabled.focus,
.btn-danger[disabled].focus, .btn-danger[disabled].focus,
fieldset[disabled] .btn-danger.focus, fieldset[disabled] .btn-danger.focus {
.btn-danger.disabled:active,
.btn-danger[disabled]:active,
fieldset[disabled] .btn-danger:active,
.btn-danger.disabled.active,
.btn-danger[disabled].active,
fieldset[disabled] .btn-danger.active {
background-color: #d9534f; background-color: #d9534f;
border-color: #d43f3a; border-color: #d43f3a;
} }
@@ -3817,6 +3764,7 @@ tbody.collapse.in {
border-radius: 0; border-radius: 0;
} }
.btn-group-vertical > .btn:first-child:not(:last-child) { .btn-group-vertical > .btn:first-child:not(:last-child) {
border-top-left-radius: 4px;
border-top-right-radius: 4px; border-top-right-radius: 4px;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
@@ -3824,6 +3772,7 @@ tbody.collapse.in {
.btn-group-vertical > .btn:last-child:not(:first-child) { .btn-group-vertical > .btn:last-child:not(:first-child) {
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;
} }
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
@@ -3881,6 +3830,9 @@ tbody.collapse.in {
width: 100%; width: 100%;
margin-bottom: 0; margin-bottom: 0;
} }
.input-group .form-control:focus {
z-index: 3;
}
.input-group-lg > .form-control, .input-group-lg > .form-control,
.input-group-lg > .input-group-addon, .input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn { .input-group-lg > .input-group-btn > .btn {
@@ -4792,7 +4744,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus {
.pagination > li > span:hover, .pagination > li > span:hover,
.pagination > li > a:focus, .pagination > li > a:focus,
.pagination > li > span:focus { .pagination > li > span:focus {
z-index: 3; z-index: 2;
color: #23527c; color: #23527c;
background-color: #eee; background-color: #eee;
border-color: #ddd; border-color: #ddd;
@@ -4803,7 +4755,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus {
.pagination > .active > span:hover, .pagination > .active > span:hover,
.pagination > .active > a:focus, .pagination > .active > a:focus,
.pagination > .active > span:focus { .pagination > .active > span:focus {
z-index: 2; z-index: 3;
color: #fff; color: #fff;
cursor: default; cursor: default;
background-color: #337ab7; background-color: #337ab7;
@@ -5024,6 +4976,8 @@ a.badge:focus {
} }
.container .jumbotron, .container .jumbotron,
.container-fluid .jumbotron { .container-fluid .jumbotron {
padding-right: 15px;
padding-left: 15px;
border-radius: 6px; border-radius: 6px;
} }
.jumbotron .container { .jumbotron .container {
@@ -5978,7 +5932,6 @@ button.close {
opacity: .5; opacity: .5;
} }
.modal-header { .modal-header {
min-height: 16.42857143px;
padding: 15px; padding: 15px;
border-bottom: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5;
} }
@@ -6371,6 +6324,7 @@ button.close {
color: #fff; color: #fff;
text-align: center; text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, .6); text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
background-color: rgba(0, 0, 0, 0);
filter: alpha(opacity=50); filter: alpha(opacity=50);
opacity: .5; opacity: .5;
} }
@@ -6484,16 +6438,16 @@ button.close {
.carousel-control .icon-next { .carousel-control .icon-next {
width: 30px; width: 30px;
height: 30px; height: 30px;
margin-top: -15px; margin-top: -10px;
font-size: 30px; font-size: 30px;
} }
.carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-left,
.carousel-control .icon-prev { .carousel-control .icon-prev {
margin-left: -15px; margin-left: -10px;
} }
.carousel-control .glyphicon-chevron-right, .carousel-control .glyphicon-chevron-right,
.carousel-control .icon-next { .carousel-control .icon-next {
margin-right: -15px; margin-right: -10px;
} }
.carousel-caption { .carousel-caption {
right: 20%; right: 20%;
@@ -6532,6 +6486,8 @@ button.close {
.pager:after, .pager:after,
.panel-body:before, .panel-body:before,
.panel-body:after, .panel-body:after,
.modal-header:before,
.modal-header:after,
.modal-footer:before, .modal-footer:before,
.modal-footer:after { .modal-footer:after {
display: table; display: table;
@@ -6551,6 +6507,7 @@ button.close {
.navbar-collapse:after, .navbar-collapse:after,
.pager:after, .pager:after,
.panel-body:after, .panel-body:after,
.modal-header:after,
.modal-footer:after { .modal-footer:after {
clear: both; clear: both;
} }

55
WebRoot/css/menu-css.css Normal file
View File

@@ -0,0 +1,55 @@
@charset "utf-8";
.menu ul li {
display:block;
width:311px;
padding-top:2px;
margin-bottom:5px;
background: url(../images/zakladka.png) top left no-repeat;
list-style:none;
overflow:visible;
}
.menu ul li a {
display:block;
height:34px; width:273px;
margin-top:0px;
padding-top:10px;
padding-left:35px;
font-size:14px;
color:#82846f;
outline:none;
}
.menu ul li .active {
background:url(../images/on.png) top right no-repeat;
}
.menu ul li .inactive {
background:url(../images/off.png) top right no-repeat;
}
.menu ul li ul {
display:none;
margin-top:-4px;
margin-bottom:20px;
}
.menu ul li ul li ul {
margin-bottom:5px;
}
.menu ul li ul li {
display:block;
background:none;
font-size:12px;
list-style:circle;
color:#8f9d4c;
margin-bottom:0px;
margin-top:0px;
padding-top:0px;
padding-bottom:0px;
padding-left:1px;
margin-left:35px;
}
.menu ul li ul li a {
background:none;
font-size:12px;
height:15px;
color:#8f9d4c;
padding-left:0px;
}

View File

@@ -9,14 +9,30 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>帖子详情</title> <title>帖子详情</title>
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet"> <link href="font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="forum/css/plugins/iCheck/custom.css" rel="stylesheet"> <link href="forum/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="forum/css/animate.css" rel="stylesheet"> <link href="forum/css/animate.css" rel="stylesheet">
<link href="forum/css/style.css" rel="stylesheet"> <link href="forum/css/style.css" rel="stylesheet">
<script type="text/javascript">
function validateSubject(field) {
return (field == "") ? "主题不能为空--" : ""
}
function validateContent(field) {
return (field == "") ? "内容不能为空--" : ""
}
function validate(form) {
fail = validateSubject(form.subject.value)
fail += validateContent(form.content.value)
if (fail == "") return true;
else {
alert(fail);return false;
} //判断表单的内容不能为空
}
</script>
</head> </head>
<body> <body>
@@ -29,6 +45,12 @@
Object user0 = session.getAttribute("actualuser"); Object user0 = session.getAttribute("actualuser");
/* out.println("欢迎"+user0);//输出当前session用户 */ /* out.println("欢迎"+user0);//输出当前session用户 */
%> %>
<%
String k1 = request.getQueryString();//得到ID的值(id=数字).
String re = "\\D+"; //正则表达式
String result = k1.replaceAll(re, ""); //找到不是数字的字符,用""替代
%>
<%@ include file="module/top.jsp"%> <%@ include file="module/top.jsp"%>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
@@ -39,47 +61,77 @@
<div class="col-md-8"> <div class="col-md-8">
<h2>帖子详情</h2> <h2>帖子详情</h2>
</div> </div>
<div class="col-md-2"> <div class="col-md-4 pull-right">
<a class="btn btn-default pull-right createNew" href="index.jsp" <a class="btn btn-default pull-right createNew" href="index.jsp"
role="button">回到首页</a> role="button">回到首页</a>
</div> </div>
</div>
<%
String id = request.getParameter("id");
Connection con;
Statement sql; <%
ResultSet rs; String id = request.getParameter("id");
String content = ""; String username = "";
try { Connection con;
Class.forName("com.mysql.jdbc.Driver"); Statement sql;
} catch (ClassNotFoundException e) { ResultSet rs;
out.print("驱动异常"); String content = "";
} try {
con = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8", Class.forName("com.mysql.jdbc.Driver");
"root", ""); } catch (ClassNotFoundException e) {
sql = con.createStatement(); out.print("驱动异常");
String send = null; }
content = "select subject,content,time from send where id = '" + request.getParameter("id") + "'"; con = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8",
rs = sql.executeQuery(content); "root", "");
try { sql = con.createStatement();
String send = null;
content = "select subject,content,time,flag,username from send where id = '" + request.getParameter("id")
+ "'";
rs = sql.executeQuery(content);
while (rs.next()) { while (rs.next()) {
%> %>
<%
if (rs.getInt("flag") == 0) {
%>
<div class="col-md-4 pull-right">
<a class="btn btn-success pull-right createNew"
href="forum/submitTop.jsp?id=<%=result%>" role=button>置顶帖子</a>
</div>
<%
} else {
%>
<div class="col-md-4 pull-right">
<a class="btn btn-warning pull-right createNew"
href="forum/submitDown.jsp?id=<%=result%>" role=button>取消置顶</a>
</div>
<%
}
%>
</div>
<div class="row"> <div class="row">
<div class="mail_box col-lg-10 col-md-10"> <div class="mail_box col-lg-10 col-md-10">
<div class="mail-tools tooltip-demo m-t-md "> <div class="mail-tools tooltip-demo m-t-md">
<div class="mail-body"> <div class="mail-body">
<h3> <h3>
<span class="font-noraml">主题: </span><%=rs.getString("subject")%> <%
</h3> if (rs.getInt("flag") == 1) {
<h5> %>
<span class="pull-right font-noraml"><%=rs.getDate("time")%>&nbsp<%=rs.getTime("time")%></span> <span class="font-noraml">主题: </span><strong style="color=red"><%=rs.getString("subject")%></strong>
<%
} else {
%>
<span class="font-noraml">主题: </span>><%=rs.getString("subject")%>
<%
}
%>
</h3>
</h5>
</div> </div>
@@ -87,19 +139,25 @@
<div class="mail-Content"> <div class="mail-Content">
<h3>内容</h3> <h3>内容</h3>
<%=rs.getString("content")%> <%=rs.getString("content")%>
<h5>
<span class="pull-right font-noraml"><%=rs.getString("username")%>&nbsp<%=rs.getDate("time")%>&nbsp<%=rs.getTime("time")%></span>
</h5>
<% <%
}
} catch (Exception e) {
} }
sql.close(); sql.close();
rs.close(); rs.close();
con.close(); con.close();
%> %>
</div> </div>
<div class="mail-body"> <div class="mail-body">
<h3>评论信息</h3> <h3>评论信息</h3>
<% <%
int floor = 1;
Connection comcon; Connection comcon;
Statement comsql; Statement comsql;
ResultSet comrs; ResultSet comrs;
@@ -111,23 +169,24 @@
comcon = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs", "root", ""); comcon = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs", "root", "");
comsql = comcon.createStatement(); comsql = comcon.createStatement();
String comment = null; String comment = null;
comment = "select comment,time from comment where subid = (select id from send where id ='" + id + "')"; comment = "select commentid,comment,time,username from comment where subid = (select id from send where id ='"
+ id + "')";
comrs = comsql.executeQuery(comment); comrs = comsql.executeQuery(comment);
try { try {
while (comrs.next()) { while (comrs.next()) {
%> %>
<div class="mail-body"> <div class="mail-body">
<a class="btn btn-danger btn-xs"
href="forum/deleteComment.jsp?commentid=<%=comrs.getInt("commentid")%>"
role="button"> <span class="glyphicon glyphicon-remove"></span></a>
<%=comrs.getString("comment")%> <%=comrs.getString("comment")%>
<h5> <h5>
<span class="pull-right font-noraml"><%=comrs.getDate("time")%>&nbsp<%=comrs.getTime("time")%></span> <span class="pull-right font-noraml"><%=floor++%>L&nbsp<%=comrs.getString("username")%>&nbsp<%=comrs.getDate("time")%>&nbsp<%=comrs.getTime("time")%></span>
</h5> </h5>
</div> </div>
@@ -140,21 +199,19 @@
comsql.close(); comsql.close();
comrs.close(); comrs.close();
comcon.close(); comcon.close();
String k1 = request.getQueryString();//得到ID的值(id=数字).
String re = "\\D+";
String result = k1.replaceAll(re, ""); //找到不是数字的字符,用""替代
%> %>
</div> </div>
<br> <br> <br> <br> <br> <br> <br> <br>
<div class="mail-text h-200"> <div class="mail-text h-200">
<form action="forum/sendComment.jsp"> <form action="forum/sendComment.jsp" onsubmit="return validate(this)">
<input type="hidden" name="subid" value=<%=result%>> <input type="hidden" name="subid" value=<%=result%>>
<h4>评论</h4> <h4>评论</h4>
<textarea rows="10" cols="135" name="comment" <textarea rows="10" cols="135" name="comment"
class="form-control"></textarea> class="form-control"></textarea>
<input class="btn btn-default pull-right createNew" <input class="btn btn-default pull-right createNew"
type="submit" value="提交"> type="submit" value="提交"> <input type="hidden"
name="username" value="<%=user1%>" />
</form> </form>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
@@ -166,32 +223,34 @@
</div> </div>
<%@ include file="module/footer.jsp"%> <%@ include file="module/footer.jsp"%>
</div> </div>
</div>
</div>
<!-- Mainly scripts --> <!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script> <script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.js" type="text/javascript"></script> <script src="js/bootstrap.js" type="text/javascript"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script> <script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript --> <!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script> <script src="js/inspinia.js"></script>
<script src="js/plugins/pace/pace.min.js"></script> <script src="js/plugins/pace/pace.min.js"></script>
<!-- iCheck --> <!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js"></script> <script src="js/plugins/iCheck/icheck.min.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.i-checks').iCheck({ $('.i-checks').iCheck({
checkboxClass : 'icheckbox_square-green', checkboxClass : 'icheckbox_square-green',
radioClass : 'iradio_square-green', radioClass : 'iradio_square-green',
}); });
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@@ -46,6 +46,11 @@ h3, h4, h5 {
.createNew{ .createNew{
margin-top: 15px; margin-top: 15px;
} }
.deleteTitle{
margin-right: 15px;
margin-top: 5px;
margin-bottom: 5px;
}
body:not (.fixed-sidebar ):not (.canvas-menu ).mini-navbar .nav li:hover>.nav-second-level, body:not (.fixed-sidebar ):not (.canvas-menu ).mini-navbar .nav li:hover>.nav-second-level,
.mini-navbar .nav li:focus>.nav-second-level { .mini-navbar .nav li:focus>.nav-second-level {
display: block; display: block;

View File

@@ -0,0 +1,45 @@
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>删除评论</title>
<meta http-equiv="refresh" content="1;url=../index.jsp">
<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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<body>
<%
String k1 = request.getQueryString();//得到ID的值(id=数字).
String re = "\\D+"; //正则表达式
String result = k1.replaceAll(re, ""); //找到不是数字的字符,用""替代
Connection con;Statement sql;
try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");}
try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root","");
sql=con.createStatement();
String text="delete from comment where commentid = '"+result+"'" ;
sql.executeUpdate(text);
sql.close();
con.close();
out.print("成功删除评论");
}catch(SQLException event){out.print("删除评论失败");}
%>
</body>
</html>

View File

@@ -0,0 +1,46 @@
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>删除帖子</title>
<meta http-equiv="refresh" content="1;url=../index.jsp">
<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">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<body >
<%
String s[] = request.getParameterValues("chk");
Connection con;Statement sql;ResultSet rs;
try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");}
try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root","");
sql=con.createStatement();
if(s!=null){
for(int i=0;i<s.length;i++){
String text="delete from send where id = '"+s[i]+"'";
sql.executeUpdate(text);
}
}
sql.close();
con.close();
out.print("成功删除帖子");
}catch(SQLException event){out.print("删除帖子失败");}
%>
</body>
</html>

View File

@@ -1,5 +1,5 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %> <%@ page import="java.sql.*"%>
<%-- <%! <%-- <%!
public String codeString(String s) public String codeString(String s)
{ String str=s; { String str=s;
@@ -12,24 +12,40 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="2;url=../index.jsp"> <meta http-equiv="refresh" content="1;url=../index.jsp">
</head> </head>
<body> <body>
<% <%
request.setCharacterEncoding("utf-8"); /* String URL = "sendForum.jsp";
String k2 = request.getParameter("subject"); String referer = response.getHeader("Referer");
String k3 = request.getParameter("content"); if (referer == null || !referer.startsWith(URL)) {
Connection con;Statement sql;ResultSet rs; response.sendRedirect(URL);
try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");} return;
try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root",""); } */
sql=con.createStatement(); request.setCharacterEncoding("utf-8");
String text="insert into send(subject,content,time) values('"+k2+"','"+k3+"',now())"; String k2 = request.getParameter("subject");
sql.executeUpdate(text); String k3 = request.getParameter("content");
sql.close(); String k4 = request.getParameter("username");
con.close(); Connection con;
out.print("成功发表帖子"); Statement sql;
}catch(SQLException event){out.print("数据更新异常");} ResultSet rs;
try {
%> Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
out.print("驱动异常");
}
try {
con = DriverManager.getConnection(
"jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8", "root", "");
sql = con.createStatement();
String text = "insert into send(subject,content,time,username) values('" + k2 + "','" + k3 + "',now(),'" + k4 + "')";
sql.executeUpdate(text);
sql.close();
con.close();
out.print("成功发表帖子");
} catch (SQLException event) {
out.print("数据更新异常");
}
%>
</body> </body>
</html> </html>

View File

@@ -28,14 +28,19 @@
<body> <body>
<% <%
String referer=response.getHeader("Referer");
if(referer==null||!referer.startsWith("detail.jsp")){
response.sendRedirect("../index.jsp");
}
request.setCharacterEncoding("utf-8"); request.setCharacterEncoding("utf-8");
String k5 = request.getParameter("comment"); String k5 = request.getParameter("comment");
String k6 = request.getParameter("subid"); String k6 = request.getParameter("subid");
String k7 = request.getParameter("username");
Connection con; Statement sql;ResultSet rs; Connection con; Statement sql;ResultSet rs;
try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");} try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");}
try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root",""); try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root","");
sql=con.createStatement(); sql=con.createStatement();
String text="insert into comment(subid,comment,time) values('"+k6+"','"+k5+"',now())"; String text="insert into comment(subid,comment,time,username) values('"+k6+"','"+k5+"',now(),'"+k7+"')";
sql.executeUpdate(text); sql.executeUpdate(text);
sql.close(); sql.close();

View File

@@ -0,0 +1,39 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<%!
public String codeString(String s)
{ String str=s;
try{byte b[]=str.getBytes("ISO-8859-1");
str=new String(b); return str;
} catch(Exception e) { return str; }
}
%>
<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="1;url=../index.jsp">
<body >
<%
/* String referer=response.getHeader("Referer");
if(referer==null||!referer.startsWith("detail.jsp")){
response.sendRedirect("../index.jsp");
return;
} */
String k1 = request.getQueryString();//得到ID的值(id=数字).
String re = "\\D+"; //正则表达式
String result = k1.replaceAll(re, ""); //找到不是数字的字符,用""替代
Connection con;Statement sql;
try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");}
try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root","");
sql=con.createStatement();
String text="update send set flag = 0 where id = '"+result+"'";
sql.executeUpdate(text);
sql.close();
con.close();
out.print("成功取消置顶");
}catch(SQLException event){out.print("取消置顶失败");}
%>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="1;url=../index.jsp">
<body>
<%
/* String referer=response.getHeader("Referer"); //防止用户在地址栏上直接访问
if(referer==null||!referer.startsWith("detail.jsp")){
response.sendRedirect("../index.jsp");
return;
} */
String k1 = request.getQueryString();//得到ID的值(id=数字).
String re = "\\D+"; //正则表达式
String result = k1.replaceAll(re, ""); //找到不是数字的字符,用""替代
Connection con;Statement sql;
try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");}
try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root","");
sql=con.createStatement();
String text="update send set flag = 1 where id = '"+result+"'";
sql.executeUpdate(text);
sql.close();
con.close();
out.print("成功置顶帖子");
}catch(SQLException event){out.print("置顶帖子失败");}
%>
</body>
</html>

View File

@@ -44,38 +44,44 @@
<h2>帖子列表</h2> <h2>帖子列表</h2>
</div> </div>
<div class="col-md-2 pull-right"> <div class="col-md-2 pull-right">
<a class="btn btn-default pull-right createNew" href="send.jsp" <a class="btn btn-default pull-right createNew"
role="button">发表帖子</a> href="sendForum.jsp" role="button">发表帖子</a>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="mail-tools"> <div class="mail-tools">
<div class="btn-group pull-right"></div> <div class="btn-group pull-right"></div>
<form action="forum/deletesend.jsp" method="post">
<% <input class="btn btn-danger deleteTitle pull-right"
Connection con; type="submit" value="删除帖子">
Statement sql; <%
ResultSet rs; Connection con;
int id = 0; Statement sql;
String subject = "", content = ""; ResultSet rs;
Date time = new Date(); int id = 0;
SimpleDateFormat sdf = new SimpleDateFormat(); String regex1 = "<(?!img).*?>";
sdf.format(time); /* String username = "admin"; */
try { String subject = "", content = "", username = "";
Class.forName("com.mysql.jdbc.Driver"); Date time = new Date();
} catch (ClassNotFoundException e) { SimpleDateFormat sdf = new SimpleDateFormat();
out.print("驱动异常"); sdf.format(time);
} try {
con = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8", Class.forName("com.mysql.jdbc.Driver");
"root", ""); } catch (ClassNotFoundException e) {
sql = con.createStatement(); out.print("驱动异常");
String send = null; }
content = "select id,subject,time from send"; con = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8",
rs = sql.executeQuery(content); "root", "");
while (rs.next()) { sql = con.createStatement();
id = rs.getInt("id"); String send = null;
subject = rs.getString("subject"); content = "select id,subject,username,time,flag from send order by flag desc,id";
%> rs = sql.executeQuery(content);
while (rs.next()) {
id = rs.getInt("id");
subject = rs.getString("subject");
username = rs.getString("username");
String str = String.valueOf(id);
%>
@@ -83,53 +89,97 @@
<div class="row">
<table class="table table-hover"> <table class="table table-hover">
<tbody> <tbody>
<tr> <tr>
<td><input type="checkbox" class="checkbox"></td> <td><input type="checkbox" class="checkbox" name="chk"
<td><a href="detail.jsp?id=<%=id%>"><%=subject%></a></td> id="chk" value=<%=id%>></td>
<td class="text-right mail-date"><%=rs.getDate("time")%>&nbsp<%=rs.getTime("time")%></td> <%
</tr> if (rs.getInt("flag") == 1 && subject.matches(regex1)) {
//置顶且匹配
%>
</tbody> <td><a href=" >"><strong><script
</table> type='text/html' style='display:inline;color:red;'><%=subject%></script></strong></a>
<% </td>
} <%
sql.close(); }
rs.close(); if (rs.getInt("flag") == 0 && !(subject.matches(regex1))) {
con.close(); //不置顶不匹配
%> %>
<td><a href="detail.jsp?id=<%=id%>"><%=subject%></a>
</td>
<%
}
if (rs.getInt("flag") == 1 && !(subject.matches(regex1))) {
//置顶但不匹配
%>
<td><a href="detail.jsp?id=<%=id%>"><strong><script
type='text/html' style='display:inline;color:red;'><%=subject%></script></strong></a>
</td>
<%
}
if (rs.getInt("flag") == 0 && subject.matches(regex1)) {
//不置顶但匹配
%>
<td><a href="detail.jsp?id=<%=id%>"><script
type='text/html' style='display:inline'><%=subject%></script></a>
</td>
<%
}
%>
<td class="text-right mail-date"><%=username%>&nbsp&nbsp<%=rs.getDate("time")%>&nbsp<%=rs.getTime("time")%></td>
</tr>
</tbody>
</table>
</div>
<%
}
sql.close();
rs.close();
con.close();
%>
</form>
<div class="col-md-4 pull-right"></div>
</div> </div>
</div> </div>
<%@ include file="module/footer.jsp"%>
</div> </div>
</div>
<%@ include file="module/footer.jsp"%>
</div>
<!-- Mainly scripts --> <!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script> <script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script> <script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript --> <!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script> <script src="js/inspinia.js"></script>
<script src="js/plugins/pace/pace.min.js"></script> <script src="js/plugins/pace/pace.min.js"></script>
<!-- iCheck --> <!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js"></script> <script src="js/plugins/iCheck/icheck.min.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.i-checks').iCheck({ $('.i-checks').iCheck({
checkboxClass : 'icheckbox_square-green', checkboxClass : 'icheckbox_square-green',
radioClass : 'iradio_square-green', radioClass : 'iradio_square-green',
}); });
}); });
</script> </script>
</body> </body>
</html> </html>

51
WebRoot/js/menu_min.js Normal file
View File

@@ -0,0 +1,51 @@
(function($) {
$.fn.menu = function(b) {
var c,
item,
httpAdress;
b = jQuery.extend({
Speed: 220,
autostart: 1,
autohide: 1
},
b);
c = $(this);
item = c.children("ul").parent("li").children("a");
httpAdress = window.location;
item.addClass("inactive");
function _item() {
var a = $(this);
if (b.autohide) {
a.parent().parent().find(".active").parent("li").children("ul").slideUp(b.Speed / 1.2,
function() {
$(this).parent("li").children("a").removeAttr("class");
$(this).parent("li").children("a").attr("class", "inactive")
})
}
if (a.attr("class") == "inactive") {
a.parent("li").children("ul").slideDown(b.Speed,
function() {
a.removeAttr("class");
a.addClass("active")
})
}
if (a.attr("class") == "active") {
a.removeAttr("class");
a.addClass("inactive");
a.parent("li").children("ul").slideUp(b.Speed)
}
}
item.unbind('click').click(_item);
if (b.autostart) {
c.children("a").each(function() {
if (this.href == httpAdress) {
$(this).parent("li").parent("ul").slideDown(b.Speed,
function() {
$(this).parent("li").children(".inactive").removeAttr("class");
$(this).parent("li").children("a").addClass("active")
})
}
})
}
}
})(jQuery);

View File

@@ -1,59 +0,0 @@
<%@ page language="java" import="java.sql.*" contentType="text/html;charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'check.jsp' starting page</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>
<%
request.setCharacterEncoding("utf-8");
String users=request.getParameter("inputUser");
String pass=request.getParameter("inputPassword");
boolean flag=false;
PreparedStatement sql=null;
ResultSet rs=null;
Connection conn=null;
%>
<%
String driver = "com.mysql.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/db_school";
String use = "root";
String password = "";
Class.forName(driver);
conn= DriverManager.getConnection(url,use,password);
sql =conn.prepareStatement("select * from user where userName=? and password=?");
sql.setString(1,users);
sql.setString(2,pass);
rs=sql.executeQuery();
if (rs.next()) {
flag=true;
}
rs.close();
sql.close();
conn.close();
%>
<!-- 判断是否是正确的登录用户 -->
<% if (flag==true){ %>
<jsp:forward page="login_show.jsp"/>
<%}
else
if (flag==false){
%>
<jsp:forward page="login_fail.jsp"/>
<%} %>
</body>
</html>

View File

@@ -1,29 +0,0 @@
<%@ page language="java" import="java.sql.*" contentType="text/html;charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>登录失败</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>
<% out.println("登录失败,5秒后自动跳转回登录页面");%>
<% response.setHeader("refresh","5;url=index.html");%>
</body>
</html>

View File

@@ -1,27 +0,0 @@
<%@ page language="java" import="java.util.*" contentType="text/html;charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>登录成功</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>
登录成功. <br>
<% response.setHeader("refresh","0;url=manage.html");%>
</body>
</html>

View File

@@ -1,16 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÎÞ±êÌâÎĵµ</title>
<style type="text/css">
<!--
body {
background-color: #00FFFFF;
}
-->
</style></head>
<body>
</body>
</html>

View File

@@ -82,9 +82,9 @@ String str_date2 = currentTime.toString(); //将Date型日期时间转换成字
<%-- <%=counter %> --%> <%-- <%=counter %> --%>
<div class="col-lg-1 col-md-1 hidden-xs"></div> <div class="col-lg-1 col-md-1 hidden-xs"></div>
<div class="col-lg-9 col-md-9"> <div class="col-lg-9 col-md-9">
<div id="carousel-example-generic" class="carousel slide" <!-- <div id="carousel-example-generic" class="carousel slide"
data-ride="carousel"> data-ride="carousel">
<!-- Indicators --> Indicators
<ol class="carousel-indicators"> <ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" <li data-target="#carousel-example-generic" data-slide-to="0"
class="active"></li> class="active"></li>
@@ -92,7 +92,7 @@ String str_date2 = currentTime.toString(); //将Date型日期时间转换成字
<li data-target="#carousel-example-generic" data-slide-to="2"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol> </ol>
<!-- Wrapper for slides --> Wrapper for slides
<div class="carousel-inner" role="listbox"> <div class="carousel-inner" role="listbox">
<div class="item active"> <div class="item active">
<img src="images/index1.jpg" alt="..."> <img src="images/index1.jpg" alt="...">
@@ -105,7 +105,7 @@ String str_date2 = currentTime.toString(); //将Date型日期时间转换成字
... ...
</div> </div>
<!-- Controls --> Controls
<a class="left carousel-control" href="#carousel-example-generic" <a class="left carousel-control" href="#carousel-example-generic"
role="button" data-slide="prev"> <span role="button" data-slide="prev"> <span
class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
@@ -115,7 +115,7 @@ String str_date2 = currentTime.toString(); //将Date型日期时间转换成字
class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span> <span class="sr-only">Next</span>
</a> </a>
</div> </div> -->
<div class="jumbotron"> <div class="jumbotron">
<h1 class="text-center">欢迎访问</h1> <h1 class="text-center">欢迎访问</h1>
<p class="text-center">15信管2班</p> <p class="text-center">15信管2班</p>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÎÞ±êÌâÎĵµ</title>
</head>
<frameset rows="50,*" frameborder="no" border="0" framespacing="0">
<frame src="top.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frame src="mainframe.jsp" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>

12
WebRoot/message.jsp Normal file
View File

@@ -0,0 +1,12 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<title>消息提示</title>
</head>
<body>
${message}
<%-- <% response.setHeader("refresh","1;url=../x2_resource.jsp");%> --%>
</body>
</html>

View File

@@ -45,6 +45,8 @@
<h3>管理员档案</h3> <h3>管理员档案</h3>
<li class="active"><a href="add_admin.jsp">添加管理员<span <li class="active"><a href="add_admin.jsp">添加管理员<span
class="sr-only">(current)</span></a></li> class="sr-only">(current)</span></a></li>
<li class="active"><a href="add_docFile.jsp">添加档案<span
class="sr-only">(current)</span></a></li>
<li><a href="show_admin.jsp">查看管理员</a></li> <li><a href="show_admin.jsp">查看管理员</a></li>
<li><a href="exhibition_admin.jsp">展示管理员</a></li> <li><a href="exhibition_admin.jsp">展示管理员</a></li>
<li><a href="change_admin.jsp">修改管理员</a></li> <li><a href="change_admin.jsp">修改管理员</a></li>

View File

@@ -0,0 +1,74 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>test</title>
<link rel="stylesheet" href="../css/manage.css" type="text/css">
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../css/footer.css" type="text/css">
<script src="js/ie-emulation-modes-warning.js"></script>
<style type="text/css">
.placeholders {
margin-bottom: 20px;
text-align: center;
margin-left: 15px;
}
.placeholders h4{
margin-bottom: 0;
}
.placeholder h4{
/* padding-left:20px; */
}
.placeholder img {
display: inline-block;
border-radius: 50%;
}
</style>
</head>
<body>
<div class="col-lg-2 col-md-2 hidden-xs">
<div class="row placeholders">
<div class="placeholder">
<img src="img/client1.jpg" width="100" height="100"
class="img-responsive" alt="用户头像">
<h4><% out.println(user1);%></h4><!-- 已在top.jsp中声明此处报错正常 -->
<span class="text-muted"><% out.println(vipuser+" "+adminuser);%></span><!-- 已在top.jsp中声明此处报错正常 -->
</div>
</div>
<ul class="nav nav-sidebar text-center
">
<h3>管理员档案</h3>
<li class="active"><a href="add_admin.jsp">添加管理员<span
class="sr-only">(current)</span></a></li>
<li class="active"><a href="add_docFile.jsp">添加档案<span
class="sr-only">(current)</span></a></li>
<li><a href="show_admin.jsp">查看管理员</a></li>
<li><a href="exhibition_admin.jsp">展示管理员</a></li>
<li><a href="change_admin.jsp">修改管理员</a></li>
</ul>
<ul class="nav nav-sidebar text-center" >
<h3>岗位管理</h3>
<li><a href="add_adminjob.jsp">添加岗位</a></li>
<li><a href="show_adminjob.jsp">查看岗位</a></li>
</ul>
<ul class="nav nav-sidebar text-center">
<h3>用户管理</h3>
<li><a href="manage_user.jsp">管理用户</a></li>
<li><a href="show_user.jsp">查看用户</a></li>
</ul>
<ul class="nav nav-sidebar text-center">
<h3>云服务</h3>
<li><a href="chartroom/login.jsp">聊天室</a></li>
<li><a href="index.jsp">论坛</a></li>
<li><a href="x2_resource.jsp">信2资源站维护中</a></li>
</ul>
</div>
<script src="../js/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="../js/bootstrap.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,100 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>发表帖子</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.css" rel="stylesheet">
<link href="forum/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="forum/css/plugins/summernote/summernote.css" rel="stylesheet">
<link href="forum/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
<link href="forum/css/animate.css" rel="stylesheet">
<link href="forum/css/style.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8">
<h2>发表帖子</h2>
</div>
<div class="col-md-4 pull-right">
<a class="btn btn-default pull-right createNew" href="index.jsp"
role="button">回到首页</a>
</div>
</div>
<form action="send.jsp" method="post">
<div class="form-group">
<label for="textTitle">主题</label>
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="主题">
<!--<input type="text" class="form-control" name="subject"></div>-->
<div class="form-group">
<label for="textContent">内容</label>
<textarea rows="10" cols="135" name="content"
class="form-control" placeholder="内容"></textarea>
<input class="btn btn-default pull-right createNew" type="submit" value="发表帖子">
</div>
</form>
</div>
</div>
<!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script>
<script src="js/plugins/pace/pace.min.js"></script>
<!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js"></script>
<!-- SUMMERNOTE -->
<script src="js/plugins/summernote/summernote.min.js"></script>
<script>
$(document).ready(function() {
$('.i-checks').iCheck({
checkboxClass : 'icheckbox_square-green',
radioClass : 'iradio_square-green',
});
$('.summernote').summernote();
});
var edit = function() {
$('.click2edit').summernote({
focus : true
});
};
var save = function() {
var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array).
$('.click2edit').destroy();
};
</script>
</body>
</html>

View File

@@ -1,4 +1,5 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -8,7 +9,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>发表帖子</title> <title>发表帖子</title>
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.css" rel="stylesheet"> <link href="css/font-awesome.css" rel="stylesheet">
@@ -26,7 +27,7 @@
<% <%
if (session.getAttribute("actualuser") == null) { if (session.getAttribute("actualuser") == null) {
out.println( out.println(
"<script language=javascript>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html'</script>"); "<script language=javascript>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html'</script>");
return; return;
} }
Object user0 = session.getAttribute("actualuser"); Object user0 = session.getAttribute("actualuser");
@@ -42,32 +43,33 @@
<div class="col-md-8"> <div class="col-md-8">
<h2>发表帖子</h2> <h2>发表帖子</h2>
</div> </div>
<div class="col-md-2 pull-right"> >
<div class="col-md-4 pull-right">
<a class="btn btn-default pull-right createNew" href="index.jsp" <a class="btn btn-default pull-right createNew" href="index.jsp"
role="button">回到首页</a> role="button">回到首页</a>
</div> </div>
</div> </div>
<div class="row">
<form action="forum/send.jsp" method="post">
<form action="send.jsp" method="post">
<div class="form-group">
<label for="textTitle">主题</label> <input type="text"
class="form-control" id="exampleInputEmail1" placeholder="主题">
<!--<input type="text" class="form-control" name="subject"></div>-->
<div class="form-group"> <div class="form-group">
<label for="textTitle">主题</label> <input type="text" <label for="textContent">内容</label>
class="form-control" id="exampleInputEmail1" name="subject" placeholder="主题"> <textarea rows="10" cols="135" name="content"
<!--<input type="text" class="form-control" name="subject"></div>--> class="form-control" placeholder="内容"></textarea>
<div class="form-group"> <input class="btn btn-default pull-right createNew" type="submit"
value="发表帖子">
<label for="textContent">内容</label> </div>
<textarea rows="10" cols="135" name="content" </div>
class="form-control" placeholder="内容"></textarea> </form>
<input class="btn btn-default pull-right createNew"
type="submit" value="发表帖子">
</div></div>
</form>
</div>
</div> </div>
</div> </div><%@ include file="module/footer.jsp"%></div>
<%@ include file="module/footer.jsp"%>
</div>
@@ -80,7 +82,7 @@
<!-- Mainly scripts --> <!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script> <script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.js" type="text/javascript"></script> <script src="js/bootstrap.min.js"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script> <script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
@@ -116,4 +118,4 @@
</script> </script>
</body> </body>
</html> </html>

137
WebRoot/sendForum.jsp Normal file
View File

@@ -0,0 +1,137 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>发表帖子</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.css" rel="stylesheet">
<link href="forum/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="forum/css/plugins/summernote/summernote.css"
rel="stylesheet">
<link href="forum/css/plugins/summernote/summernote-bs3.css"
rel="stylesheet">
<link href="forum/css/animate.css" rel="stylesheet">
<link href="forum/css/style.css" rel="stylesheet">
<script type="text/javascript">
function validateSubject(field) {
return (field == "") ? "主题不能为空--" : ""
}
function validateContent(field) {
return (field == "") ? "内容不能为空--" : ""
}
function validate(form) {
fail = validateSubject(form.subject.value)
fail += validateContent(form.content.value)
if (fail == "") return true;
else {
alert(fail);return false;
} //判断表单的内容不能为空
}
</script>
</head>
<body>
<%
if (session.getAttribute("actualuser") == null) {
out.println(
"<script language=javascript>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html'</script>");
return;
}
Object user0 = session.getAttribute("actualuser");
/* out.println("欢迎"+user0);//输出当前session用户 */
%>
<%@ include file="module/top.jsp"%>
<div class="container">
<div class="row">
<%@ include file="module/sidebar.jsp"%>
<div class="col-lg-1 col-md-1 hidden-xs"></div>
<div class="col-lg-9 col-md-9">
<div class="row">
<div class="col-md-8">
<h2>发表帖子</h2>
</div>
<div class="col-md-2 pull-right">
<a class="btn btn-default pull-right createNew" href="index.jsp"
role="button">回到首页</a>
</div>
</div>
<div class="row">
<form action="forum/send.jsp" method="post" onsubmit="return validate(this)">
<div class="form-group">
<label for="textTitle">主题</label> <input type="text"
class="form-control" id="exampleInputEmail1" name="subject"
placeholder="主题">
<div class="form-group">
<label for="textContent">内容</label>
<textarea rows="10" cols="135" name="content"
class="form-control" placeholder="内容"></textarea>
<input class="btn btn-default pull-right createNew"
type="submit" value="发表帖子"> <input type="hidden"
name="username" value="<%=user1%>" />
</div>
</div>
</form>
</div>
</div>
</div>
<%@ include file="module/footer.jsp"%>
</div>
<!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script>
<script src="js/plugins/pace/pace.min.js"></script>
<!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js"></script>
<!-- SUMMERNOTE -->
<script src="js/plugins/summernote/summernote.min.js"></script>
<script>
$(document).ready(function() {
$('.i-checks').iCheck({
checkboxClass : 'icheckbox_square-green',
radioClass : 'iradio_square-green',
});
$('.summernote').summernote();
});
var edit = function() {
$('.click2edit').summernote({
focus : true
});
};
var save = function() {
var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array).
$('.click2edit').destroy();
};
</script>
</body>
</html>

View File

@@ -1,51 +0,0 @@
<%@ page language="java" import="java.sql.*" contentType="text/html;charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>检验注册页面</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>
<br>
<%
request.setCharacterEncoding("utf-8");
String users=request.getParameter("inputUser");
String pass=request.getParameter("Password2");
String email=request.getParameter("Email");
String PhoneNumber=request.getParameter("PhoneNumber");
%>
<%
String driver = "com.mysql.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/db_school";
String use = "root";
String password = "";
Class.forName(driver);
Connection conn= DriverManager.getConnection(url,use,password);
PreparedStatement sql =conn.prepareStatement("insert into user(userName,password,Email,phoneNum)values(?,?,?,?)");
sql.setString(1,users);
sql.setString(2,pass);
sql.setString(3,email);
sql.setString(4,PhoneNumber);
int rtn=sql.executeUpdate();
sql.close();
conn.close();
%>
<% response.setHeader("refresh","0;url=signin_show.jsp");%>
</body>
</html>

View File

@@ -1,62 +0,0 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>学生管理</title>
<link rel="stylesheet" href="css/manage.css" type="text/css">
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="css/footer.css" type="text/css">
<script src="js/ie-emulation-modes-warning.js"></script>
</head>
<?php
require_once "common.php"
?>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#defaultNavbar1"> <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span
class="icon-bar"></span><span class="icon-bar"></span></button>
<a class="navbar-brand" href="#">F嘉阳</a></div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="defaultNavbar1">
<ul class="nav navbar-nav">
<li class="active"><a href="manage.php">首页<span class="sr-only">(current)</span></a></li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-expanded="false">学生管理<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="add_student.php">添加学生</a></li>
<li><a href="show_student.php">查看学生</a></li>
<li><a href="change_student.php">修改学生</a></li>
</ul>
</li>
<li><a href="#">班级管理</a></li>
<li><a href="#">课程管理</a></li>
<li><a href="#">成绩管理</a></li>
<li class="divider"></li>
<li><a href="#">查看所有</a></li>
<li class="divider"></li>
<li><a href="#">添加管理员</a></li>
</ul>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
</body>
</html>

16
WebRoot/upload.jsp Normal file
View File

@@ -0,0 +1,16 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<title>文件上传</title>
</head>
<body>
<form action="${pageContext.request.contextPath}/servlet/UploadHandleServlet" enctype="multipart/form-data" method="post">
上传用户:<input type="text" name="username"><br/>
上传文件1<input type="file" name="file1"><br/>
上传文件2<input type="file" name="file2"><br/>
<input type="submit" value="提交">
</form>
</body>
</html>

View File

@@ -25,7 +25,7 @@
<%@ include file="/module/top.jsp"%> <%@ include file="/module/top.jsp"%>
<div class="container"> <div class="container">
<% <%
String counter = null; String counter = null;
if (session.getAttribute("actualuser") == null) { if (session.getAttribute("actualuser") == null) {
out.println("<script>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html';</script>"); out.println("<script>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html';</script>");
return; return;
@@ -58,10 +58,10 @@
String password = ""; String password = "";
Class.forName(driverClass); Class.forName(driverClass);
try { try {
ResultSet rs = null; ResultSet rs = null;
Connection conn = null; Connection conn = null;
PreparedStatement sql = null; PreparedStatement sql = null;
conn = DriverManager.getConnection(url, user, password); conn = DriverManager.getConnection(url, user, password);
Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
sql = conn.prepareStatement("select * from x2_resourse"); sql = conn.prepareStatement("select * from x2_resourse");
@@ -72,16 +72,17 @@
<td><%=rs.getString("resName")%></td> <td><%=rs.getString("resName")%></td>
<td><%=rs.getString("size")%></td> <td><%=rs.getString("size")%></td>
<td><%=rs.getString("upLoadTime")%></td> <td><%=rs.getString("upLoadTime")%></td>
<td><%=rs.getString("downLoadTimes")%></td> <td><%=rs.getString("upLoaduser")%></td>
<td><a href="<%=rs.getString("link")%>"><button type="button" <td><a href="<%=rs.getString("link")%>"><button
class="btn btn-success disabled" disabled="disabled">下载</button></a></td> type="button" class="btn btn-success disabled"
disabled="disabled">下载</button></a></td>
</tr> </tr>
<% <%
} }
sql.close(); sql.close();
rs.close(); rs.close();
conn.close(); conn.close();
stmt.close(); stmt.close();
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
@@ -93,6 +94,24 @@
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title text-center">上传文件</h3>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-hover">
<form
action="${pageContext.request.contextPath}/servlet/UploadHandleServlet"
enctype="multipart/form-data" method="post">
<input type="text" name="username" value="<%=user1%>" /> <br />
上传文件:<input type="file" name="file1"><br> <input
class="btn btn-default" type="submit" value="提交">
</form>
</table>
</div>
</div>
</div>
</div> </div>
</div> </div>
<!-- Footer --> <!-- Footer -->

View File

@@ -0,0 +1,7 @@
package com.wgh;
public class MySqlconn {
static String driverClass = "com.mysql.jdbc.Driver";
static String user = "root";
static String password = "";
}

View File

@@ -3,4 +3,4 @@ package com.wgh;
public class UserForm public class UserForm
{ {
public String username; public String username;
} }

View File

@@ -0,0 +1,80 @@
package me.gacl.web.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DownLoadServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//得到要下载的文件名
String fileName = request.getParameter("filename"); //23239283-92489-阿凡达.avi
fileName = new String(fileName.getBytes("iso8859-1"),"UTF-8");
//上传的文件都是保存在/WEB-INF/upload目录下的子目录当中
String fileSaveRootPath=this.getServletContext().getRealPath("/WEB-INF/upload");
//通过文件名找出文件的所在目录
String path = findFileSavePathByFileName(fileName,fileSaveRootPath);
//得到要下载的文件
File file = new File(path + "\\" + fileName);
//如果文件不存在
if(!file.exists()){
request.setAttribute("message", "您要下载的资源已被删除!!");
request.getRequestDispatcher("/message.jsp").forward(request, response);
return;
}
//处理文件名
String realname = fileName.substring(fileName.indexOf("_")+1);
//设置响应头,控制浏览器下载该文件
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(realname, "UTF-8"));
//读取要下载的文件,保存到文件输入流
FileInputStream in = new FileInputStream(path + "\\" + fileName);
//创建输出流
OutputStream out = response.getOutputStream();
//创建缓冲区
byte buffer[] = new byte[1024];
int len = 0;
//循环将输入流中的内容读取到缓冲区当中
while((len=in.read(buffer))>0){
//输出缓冲区的内容到浏览器,实现文件下载
out.write(buffer, 0, len);
}
//关闭文件输入流
in.close();
//关闭输出流
out.close();
}
/**
* @Method: findFileSavePathByFileName
* @Description: 通过文件名和存储上传文件根目录找出要下载的文件的所在路径
* @Anthor:孤傲苍狼
* @param filename 要下载的文件名
* @param saveRootPath 上传文件保存的根目录,也就是/WEB-INF/upload目录
* @return 要下载的文件的存储目录
*/
public String findFileSavePathByFileName(String filename,String saveRootPath){
int hashcode = filename.hashCode();
int dir1 = hashcode&0xf; //0--15
int dir2 = (hashcode&0xf0)>>4; //0-15
String dir = saveRootPath + "\\" + dir1 + "\\" + dir2; //upload\2\3 upload\3\5
File file = new File(dir);
if(!file.exists()){
//创建目录
file.mkdirs();
}
return dir;
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}

View File

@@ -0,0 +1,67 @@
package me.gacl.web.controller;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @ClassName: ListFileServlet
* @Description: 列出Web系统中所有下载文件
* @author: 孤傲苍狼
* @date: 2015-1-4 下午9:54:40
*
*/
public class ListFileServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//获取上传文件的目录
String uploadFilePath = this.getServletContext().getRealPath("/WEB-INF/upload");
//存储要下载的文件名
Map<String,String> fileNameMap = new HashMap<String,String>();
//递归遍历filepath目录下的所有文件和目录将文件的文件名存储到map集合中
listfile(new File(uploadFilePath),fileNameMap);//File既可以代表一个文件也可以代表一个目录
//将Map集合发送到listfile.jsp页面进行显示
request.setAttribute("fileNameMap", fileNameMap);
request.getRequestDispatcher("/listfile.jsp").forward(request, response);
}
/**
* @Method: listfile
* @Description: 递归遍历指定目录下的所有文件
* @Anthor:孤傲苍狼
* @param file 即代表一个文件,也代表一个文件目录
* @param map 存储文件名的Map集合
*/
public void listfile(File file,Map<String,String> map){
//如果file代表的不是一个文件而是一个目录
if(!file.isFile()){
//列出该目录下的所有文件和目录
File files[] = file.listFiles();
//遍历files[]数组
for(File f : files){
//递归
listfile(f,map);
}
}else{
/**
* 处理文件名上传后的文件是以uuid_文件名的形式去重新命名的去除文件名的uuid_部分
file.getName().indexOf("_")检索字符串中第一次出现"_"字符的位置如果文件名类似于9349249849-88343-8344_阿_凡_达.avi
那么file.getName().substring(file.getName().indexOf("_")+1)处理之后就可以得到阿_凡_达.avi部分
*/
String realName = file.getName().substring(file.getName().indexOf("_")+1);
//file.getName()得到的是文件的原始名称这个名称是唯一的因此可以作为keyrealName是处理过后的名称有可能会重复
map.put(file.getName(), realName);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}

View File

@@ -0,0 +1,119 @@
package me.gacl.web.controller;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.omg.CORBA.PRIVATE_MEMBER;
import java.sql.*;
public class UploadHandleServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
final String DBDRIVER = "com.mysql.jdbc.Driver";
final String DBURL = "jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8";
final String USER = "root";
final String PASSWORD = "";
boolean flag = false;
request.setCharacterEncoding("utf-8");
String username = request.getParameter("username");
//得到上传文件的保存目录将上传的文件存放于WEB-INF目录下不允许外界直接访问保证上传文件的安全
String savePath = this.getServletContext().getRealPath("/WEB-INF/upload");
File file = new File(savePath);
//判断上传文件的保存目录是否存在
if (!file.exists() && !file.isDirectory()) {
System.out.println(savePath+"目录不存在,需要创建");
//创建目录
file.mkdir();
}
//消息提示
String message = "";
try{
Class.forName(DBDRIVER);
Connection conn = DriverManager.getConnection(DBURL, USER, PASSWORD);
//使用Apache文件上传组件处理文件上传步骤
//1、创建一个DiskFileItemFactory工厂
DiskFileItemFactory factory = new DiskFileItemFactory();
//2、创建一个文件上传解析器
ServletFileUpload upload = new ServletFileUpload(factory);
//解决上传文件名的中文乱码
upload.setHeaderEncoding("UTF-8");
//3、判断提交上来的数据是否是上传表单的数据
if(!ServletFileUpload.isMultipartContent(request)){
//按照传统方式获取数据
return;
}
//4、使用ServletFileUpload解析器解析上传数据解析结果返回的是一个List<FileItem>集合每一个FileItem对应一个Form表单的输入项
List<FileItem> list = upload.parseRequest(request);
for(FileItem item : list){
//如果fileitem中封装的是普通输入项的数据
if(item.isFormField()){
String name = item.getFieldName();
//解决普通输入项的数据的中文乱码问题
String value = item.getString("UTF-8");
//value = new String(value.getBytes("iso8859-1"),"UTF-8");
System.out.println(name + "=" + value);
}else{//如果fileitem中封装的是上传文件
//得到上传的文件名称,
String filename = item.getName();
PreparedStatement sql = conn
.prepareStatement("insert into x2_resourse_upload(resName,upLoadTime,upLoaduser)values(?,now(),?)");
sql.setString(1, filename);
sql.setString(2, username);
System.out.println(filename);
if(filename==null || filename.trim().equals("")){
continue;
}
//注意:不同的浏览器提交的文件名是不一样的,有些浏览器提交上来的文件名是带有路径的,如: c:\a\b\1.txt而有些只是单纯的文件名1.txt
//处理获取到的上传文件的文件名的路径部分,只保留文件名部分
filename = filename.substring(filename.lastIndexOf("\\")+1);
//获取item中的上传文件的输入流
InputStream in = item.getInputStream();
//创建一个文件输出流
FileOutputStream out = new FileOutputStream(savePath + "\\" + filename);
//创建一个缓冲区
byte buffer[] = new byte[1024];
//判断输入流中的数据是否已经读完的标识
int len = 0;
//循环将输入流读入到缓冲区当中,(len=in.read(buffer))>0就表示in里面还有数据
while((len=in.read(buffer))>0){
//使用FileOutputStream输出流将缓冲区的数据写入到指定的目录(savePath + "\\" + filename)当中
out.write(buffer, 0, len);
}
//关闭输入流
in.close();
//关闭输出流
out.close();
//删除处理文件上传时生成的临时文件
item.delete();
message = "文件上传成功!"+username;
sql.close();
conn.close();
}
}
}catch (Exception e) {
message= "文件上传失败!";
e.printStackTrace();
}
request.setAttribute("message",message);
request.getRequestDispatcher("/message.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}