最近整理博客园时发现,自己忘记发期中考试的测试题了。今天赶紧补上
校园社团活动管理系统(20分)
1、项目需求:
校园社团作为高校课外活动的重要组成部分,发展十分迅速,也受到越来越多学生的欢迎,社团规模、数量等都在日益增长,社团活动也更为多样和丰富。然而,大多数高校还没有一个完整成熟的社团管理系统,仅仅是靠人力来管理,导致效率低下,而学生也只能通过线下或者公众号的方式了解社团,另外,社团活动的通知方式也很杂乱,并没有一个信息聚合、消息发布的平台。
因此,高校有必要建立一个校园社团管理系统,使得社团管理工作规范化、系统化、程序化、科学化,提高管理工作的效率。
2.系统要求与功能设计
2.1 页面功能要求
(1)能够在Tomcat服务器中正确部署,并通过浏览器查看;(1分)
(2)网站页面整体风格统一;
图1 活动普查系统功能结构图
(3)主页面:要求显示发布活动信息、修改活动信息、删除活动信息、查询活动信息,活动信息浏览五个子菜单。(1分)
(4)发布活动信息页面:(6分)
①完成添加活动信息发布,基本信息和填报限制如下表所示
活动主题 |
字符串(不超过20个汉字) |
活动目的 |
字符串(不超过50个汉字) |
活动类型 |
社团竞赛、野外采风、校内集会、社团纳新(单选框) |
活动时间 |
文本框 |
活动地点 |
文本框 |
活动对象 |
社团成员、全体学生(复选框实现) |
活动内容 |
(文本框,不超过500个汉字) |
活动日程安排 |
(文本框,不超过500个汉字) |
②点击“提交”按钮,保存成功则跳转到活动基本信息浏览界面,新录入的信息置顶显示。失败则提示错误信息,返回当前页面
评分标准:
① 完成活动信息发布页面(未完成0分,完成1分)
② 保存活动信息入库(未完成0分,完成1分)
③ 社团竞赛、野外采风、校内集会、社团纳新实现单选框录入1分。(未完成0分,全部完成1分)
④ 实现活动对象复选框录入1分。(未完成0分,完成1分)
⑤ 实现活动主题、活动目的、活动内容、活动日程安排的字数判断,实现三个以上得1分(未完成0分,完成1分)
⑥提交后页面跳转功能;(未完成0分,完成1分)
(5)修改活动信息页面:(3分)
输入活动主题,显示其余信息,可对活动目的、活动类型、活动时间、活动地点、活动对象、活动内容、活动日程安排进行修改。(活动目的、活动类型、活动时间、活动地点、活动对象、活动内容、活动日程安排必须符合录入要求);如果该活动主题数据库不存在,则提示“该活动不存在”。(3分)
评分标准:
① 完成修改活动信息页面(未完成0分,完成1分)
② 实现数据库中信息更新(未完成0分,完成1分)
③输入活动主题,显示其余信息,若该信息不存在,提示错误信息;(未完成0分,完成1分)
(6)删除活动信息页面:录入活动主题,显示详细信息后,点击“删除”按钮,弹出提示框,提示“是否确认删除该活动信息”,确认后删除该信息。(1分)
评分标准:
① 输入活动主题可显示其余信息。(未完成0分,完成0.5分)
②对应删除数据库中信息(未完成0分,完成0.5分)
(7)浏览活动信息页面:(2分)
以列表形式显示活动基本信息,结果列表中显示活动主题、活动时间,活动类型、活动对象基本信息,点击主题,可以跳转到活动详细信息,显示全部活动信息。
① 实现以列表形式显示活动基本信息,结果列表中显示活动主题、活动时间,活动类型、活动对象基本信息(未完成0分,完成1分)
②实现跳转活动详细信息页面,显示全部活动信息。(未完成0分,完成1分)
(8)查询活动信息页面:(3分)
要求根据活动主题、活动时间、活动类型、活动地点四种条件实现模糊查询,输出结果以列表形式显示,显示显示活动主题、活动时间,活动类型、活动对象基本信息,点击列表中的活动主题,跳转到活动详细信息页面。
评分标准:
①缺少一种查询条件扣除1分。(未完成0分,完成3分)
2.2 功能要求
(1)设计出合理的数据库和数据表,要求使用mysql、sqlserver、oracle三种数据库中一种(1分)
(2)使用Serverlet实现页面交互(1分)。
(3)使用Java Bean封装数据库连接操作(1分。)
源码如下
Bean 包
package Bean;
public class bean {
private String theme ,goal,type,time,whe,object,content,arrange;
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public String getGoal() {
return goal;
}
public void setGoal(String goal) {
this.goal = goal;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getWhe() {
return whe;
}
public void setWhe(String whe) {
this.whe = whe;
}
public String getObject() {
return object;
}
public void setObject(String object) {
this.object = object;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getArrange() {
return arrange;
}
public void setArrange(String arrange) {
this.arrange = arrange;
}
public bean(String theme, String goal, String type, String time, String whe, String object, String content, String arrange)
{
this.theme = theme;
this.goal = goal;
this.type = type;
this.time = time;
this.whe = whe;
this.object = object;
this.content = content;
this.arrange = arrange;
}
}
DAO包
package Dao;
import Bean.bean;
import DBUtil.DBUtils;
import java.sql.*;
public class dao {
public static int add(bean bean) {
String sql = "insert into manage (活动主题,活动目的,活动类型,活动时间,活动地点,活动对象,活动内容,活动日程安排) values('" + bean.getTheme() + "','" + bean.getGoal() + "','" + bean.getType() + "','" + bean.getTime() + "','" + bean.getWhe() + "','" + bean.getObject() + "','" + bean.getContent() + "','" + bean.getArrange() + "')";
Connection conn = DBUtils.getConn();
Statement state = null;
int count = 0;
try {
state = conn.createStatement();
count = state.executeUpdate(sql);
} catch (Exception e) {
e.printStackTrace();
} finally {
DBUtils.close(state, conn);
}
return count;
}
public static int delete(String x) {
int count = 0;
String sql = "delete from manage where 活动主题='" + x + "'";
System.out.println(sql);
Connection conn = DBUtils.getConn();
Statement state = null;
try {
state = conn.createStatement();
count = state.executeUpdate(sql);
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
DBUtils.close(state, conn);
}
return count;
}
public static int update(bean bean1) {
String sql = "update manage set 活动目的='" + bean1.getGoal() + "',活动类型='" + bean1.getType() + "', 活动时间='" + bean1.getTime() + "',活动地点='" + bean1.getWhe() + "',活动对象='" + bean1.getObject() + "',活动内容='" + bean1.getContent() + "',活动日程安排='" + bean1.getArrange() + "'where 活动主题= '" + bean1.getTheme() + "'";
Connection conn = DBUtils.getConn();
Statement state = null;
int count = 0;
try {
state = conn.createStatement();
count = state.executeUpdate(sql);
} catch (Exception e) {
e.printStackTrace();
} finally {
DBUtils.close(state, conn);
}
return count;
}
public static bean search(String theme1,String content1,String type1 ,String object1 )
{
String sql="select * from manage where ";
if (theme1 !="") {
sql +="活动主题 like '%" + theme1+"%'";
} else if (content1 !="") {
sql +="活动内容 like '%" + content1+"%'";
}else if (type1 !="") {
sql +="活动类型 like '%" + type1+"%'";
}else if (object1 !="") {
sql +="活动对象 like '%" + object1+"%'";
}else
{
}
Connection conn=DBUtils.getConn();
Statement state=null;
ResultSet rs=null;
bean tbean=null;
try{
state=conn.createStatement();
rs=state.executeQuery(sql);
while(rs.next())
{
String theme =rs.getString("theme");
String goal=rs.getString("goal");
String type=rs.getString("type");
String time=rs.getString("time");
String whe=rs.getString("whe");
String object =rs.getString("object");
String content=rs.getString("content");
String arrange =rs.getString("arrange");
tbean=new bean(theme ,goal,type,time,whe,object,content,arrange);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
DBUtils.close(rs, state, conn);
}
return tbean;
}
}
DBUtil
package DBUtil; import com.mysql.jdbc.Driver; import javax.annotation.processing.SupportedAnnotationTypes; import java.sql.*; public class DBUtils { static final String JDBC= "com.mysql.cj.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost:3306/shetuan?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC"; //这里数据库要改成自己的(shetuan),包括下面的密码 static final String USER = "root"; static final String PASS = "123456"; public static Connection getConn () { //连接数据库 Connection conn = null; try { Class.forName(JDBC); String user = "root"; String password = "123456"; String url = "jdbc:mysql://localhost:3306/user?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true"; System.out.println("数据库连接成功"); conn = DriverManager.getConnection(url, user, password); } catch (Exception e) { e.printStackTrace(); } return conn; } public static void close(Statement state, Connection conn) { if (state != null) { try { state.close(); } catch (SQLException e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } public static void close(ResultSet rs, Statement state, Connection conn) { //关闭 if (rs != null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } if (state != null) { try { state.close(); } catch (SQLException e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
service 包
package service; import Bean.bean; import Dao.dao; public class Service { public int add(bean bean1) { String a=bean1.getTheme(); String b=bean1.getGoal(); String c=bean1.getContent(); String d=bean1.getArrange(); if(a.length()>20) return 2; if(b.length()>20) return 3; if(c.length()>20) return 4; if(d.length()>20) return 5; if(dao.add(bean1)>0) return 1; else{ return 0; } } public int delete(String theme) { if(dao.delete(theme)>0) { return 1; } else{ return 0; } } public int update(bean bean1) { if(dao.update(bean1)>0) return 1; else { return 0; } } public bean search(String theme1,String content1,String type1 ,String object1) { return dao.search(theme1,content1,type1,object1); } }
servlet 包
package servlet; import Bean.bean; import service.Service; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.annotation.*; import java.io.IOException; import java.io.UnsupportedEncodingException; @WebServlet( "/Servlet") public class Servlet extends HttpServlet { private static final long serialVersionUID=1L; Service service=new Service(); /** * @see HttpServlet#HttpServlet() */ public Servlet() { super(); } /** * @see HttpServlet#doGet(HttpServletRequest req, HttpServletResponse resp) */ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); String method=req.getParameter("method"); if("add".equals(method)){ add(req,resp); } if ("delete".equals(method)) { delete(req,resp); } if ("update".equals(method)) { update(req,resp); } if("search".equals(method)) { search(req,resp); } } private void add(HttpServletRequest req,HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("UTF-8"); String theme=req.getParameter("theme"); String goal=req.getParameter("goal"); String type=req.getParameter("type"); String time=req.getParameter("time");; String whe=req.getParameter("whe"); String object1 =req.getParameter("object1"); String object2 =req.getParameter("object2"); String content=req.getParameter("content"); String arrange =req.getParameter("arrange"); String object=null; if(object1==null && object2!=null) { object=object2; } if(object1!=null && object2==null) { object=object1; } if(object1!=null && object2!=null) { object=object1+object2; } bean bean1=new bean(theme,goal,type,time,whe,object,content,arrange); int x= service.add(bean1); if(x==1){ req.setAttribute("message","添加成功"); req.getRequestDispatcher("show.jsp").forward(req,resp); }if(x==0){ req.setAttribute("message","添加失败,请重新录入"); req.getRequestDispatcher("add.jsp").forward(req,resp); }if(x==2){ req.setAttribute("message","主题过长"); req.getRequestDispatcher("add.jsp").forward(req,resp); }if(x==3){ req.setAttribute("message","目的过长"); req.getRequestDispatcher("add.jsp").forward(req,resp); }if(x==4){ req.setAttribute("message","内容过长"); req.getRequestDispatcher("add.jsp").forward(req,resp); }if(x==5){ req.setAttribute("message","安排过长"); req.getRequestDispatcher("add.jsp").forward(req,resp); } } private void delete(HttpServletRequest req,HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("UTF-8"); String theme=req.getParameter("theme"); int x= service.delete(theme); if(x>0) { req.setAttribute("message","删除成功"); req.getRequestDispatcher("menu.jsp").forward(req,resp); } else{ req.setAttribute("message","删除失败"); req.getRequestDispatcher("delete.jsp").forward(req,resp); } } private void update(HttpServletRequest req,HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("UTF-8"); String theme=req.getParameter("theme"); String goal=req.getParameter("goal"); String type=req.getParameter("type"); String time=req.getParameter("time");; String whe=req.getParameter("whe"); String object1 =req.getParameter("object1"); String object2 =req.getParameter("object2"); String content=req.getParameter("content"); String arrange =req.getParameter("arrange"); String object=null; if (object1==null && object2!=null) { object=object2; } if(object1!=null && object2==null) { object=object1; } if(object1!=null && object2!=null) { object=object1+object2; } bean bean1=new bean(theme,goal,type,time,whe,object,content,arrange); int x= service.update(bean1); if(x>0) { req.setAttribute("message","修改成功"); req.getRequestDispatcher("menu.jsp").forward(req,resp); } else{ req.setAttribute("message","修改失败"); req.getRequestDispatcher("update.jsp").forward(req,resp); } } private void search(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); String theme=req.getParameter("theme"); String type=req.getParameter("type"); String object1=req.getParameter("object"); String content=req.getParameter("content"); bean bean1=service.search(theme,type,content,object1); System.out.println(bean1); if(bean1 == null) { req.setAttribute("message","查无此人"); req.getRequestDispatcher("search.jsp").forward(req,resp); } else{ req.setAttribute("bean",bean1); req.getRequestDispatcher("search1.jsp").forward(req,resp); } } /** * @see HttpServlet#doPost(HttpServletRequest req, HttpServletResponse resp) */ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req,resp); } }
jsp文件
add.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>发布活动信息</title> </head> <body> <% Object message= request.getAttribute("message"); if(message!=null&&!"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>") </script> <%}%> <form name="form1" action ="Servlet?method=add" method="post" onsubmit="return check()"> <table align="center" border="1" width="500"> <tr> <td>1.活动主题: </td> <td> <label> <input type="text" name="theme"/> </label> </td> </tr> <tr> <td>2.活动目的: </td> <td> <label> <input type="text" name="goal"/> </label> </td> </tr> <tr> <td>3.活动类型: </td> <td> <label> <input type="radio" name="type" value="社团竞赛">社团竞赛 <input type="radio" name="type" value="野外采风">野外采风 <input type="radio" name="type" value="校内集会">校内集会 <input type="radio" name="type" value="社团纳新">社团纳新 </label> </td> </tr> <tr> <td>4.活动时间: </td> <td> <label> <input type="text" name="time"/> </label> </td> </tr> <tr> <td>5.活动地点: </td> <td> <label> <input type="text" name="whe"/> </label> </td> </tr> <tr> <td>6.活动对象: </td> <td> <label> <input type="checkbox" name="object1" value="社团人员"/>社团人员 <input type="checkbox" name="object2" value="全体学生"/>全体学生 </label> </td> </tr> <tr> <td>7.活动内容: </td> <td> <label> <input type="text" name="content"/> </label> </td> </tr> <tr> <td>8.活动安排: </td> <td> <label> <input type="text" name="arrange"/> </label> </td> </tr> <tr align="center"> <td colspan="2"> <input type="submit" value="提交"/> <input type="reset" value="重置"/> </td> </tr> </table> </form> </body> </html>
delete.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>删除界面</title> </head> <body> <div align="center"> <form name="form" method="post" action="menu.jsp"> <input type="submit" value="返回主页"> </form> <% Object message=request.getAttribute("message"); if(message!=null&& !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%}%> <form action ="Servlet?method=delete" method="post" onsubmit="return check()"> 请输入您要删除的主题 <input type="text" name="theme"/> <input type="submit" value="删除"/> </form> </body> </html>
search.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>查询</title> </head> <body> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <form name="form" action="Servlet?method=search" method="post" onsubmit="return check()"> <table align="center" border="1" width="500"> <tr> <td>1.活动主题: </td> <td> <label> <input type="text" name="theme" /> </label> </td> </tr> <tr> <td>2.活动时间: </td> <td> <label> <input type="text" name="time" /> </label> </td> </tr> <tr> <td>3.活动类型: </td> <td> <label> <input type="text" name="type" /> </label> </td> </tr> <tr> <td>4.活动对象: </td> <td> <label> <input type="text" name="object" /> </label> </td> </tr> <tr align="center"> <td colspan="2"> <input type="submit" value="查询" /> <input type="reset" value="重置" /> </td> </tr> </table> </form> </body> </html>
search1.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>查询结果</title> </head> <body> <div align="center"> <form name="form" method="post" action="menu.jsp"> <input type="submit" value="返回主页"> </form> <table align="center" border="1" width="500"> <tr> <td>1.主题: </td> <td> <label> ${bean.theme} </label> </td> </tr> <tr> <td>2.目的: </td> <td> <label> ${bean.goal} </label> </td> </tr> <tr> <td>3.类型: </td> <td> <label> ${bean.type} </label> </td> </tr> <tr> <td>4.时间: </td> <td> <label> ${bean.time} </label> </td> </tr> <tr> <td>5.地点: </td> <td> <label> ${bean.whe} </label> </td> </tr> <tr> <td>6.对象: </td> <td> <label> ${bean.object} </label> </td> </tr> <tr> <td>7.内容: </td> <td> <label> ${bean.content} </label> </td> </tr> <tr> <td>8.安排: </td> <td> <label> ${bean.arrange} </label> </td> </tr> <tr> <td> <label> <form name="form" method="post" action="menu.jsp"> <input type="submit" value="返回"> </form> </label> </td> </tr> </table><%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> </head> <body> </body> </html>
update.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>修改界面</title> </head> <body><div align="center"> <form name="form" method="post" action="menu.jsp"> <input type="submit" value="返回主页"> </form> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <form name="form1" action="Servlet?method=update" method="post" onsubmit="return check()"> <table align="center" border="1" width="500"> <tr> <td>1.活动主题: </td> <td> <label> <input type="text" name="theme" /> </label> </td> </tr> <tr> <td>2.活动目的: </td> <td> <label> <input type="text" name="goal" /> </label> </td> </tr> <tr> <td>3.活动类型: </td> <td> <label> <input type="radio" name="type" value="社团竞赛" > 社团竞赛 <input type="radio" name="type" value="野外采风" >野外采风 <input type="radio" name="type" value="校内集会" > 校内集会 <input type="radio" name="type" value="社团纳新" >社团纳新 </label> </td> </tr> <tr> <td>4.活动时间: </td> <td> <label> <input type="text" name="time" /> </label> </td> </tr> <tr> <td>5.活动地点: </td> <td> <label> <input type="text" name="whe" /> </label> </td> </tr> <tr> <td>6.活动对象: </td> <td> <label> <input type="checkbox" name="object1" value="社团人员" />社团人员 <input type="checkbox" name="object2" value="全体学生" />全体学生 </label> </td> </tr> <tr> <td>7.活动内容: </td> <td> <label> <input type="text" name="centent" /> </label> </td> </tr> <tr> <td>8.活动安排: </td> <td> <label> <input type="text" name="arrange" /> </label> </td> </tr> <tr align="center"> <td colspan="2"> <input type="submit" value="修改" /> <input type="reset" value="重置" /> </td> </tr> </table> </form> </body> </html>
menu.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>主页</title> </head> <body> <div align="center"> <form name="form" method="post" action="add.jsp"> <input type="submit" value="增加活动信息"> </form> <form name="form" method="post" action="delete.jsp"> <input type="submit" value="删除活动信息"> </form> <form name="form" method="post" action="update.jsp"> <input type="submit" value="修改活动信息"> </form> <form name="form" method="post" action="search.jsp"> <input type="submit" value="查询活动信息"> </form> <form name="form" method="post" action="show.jsp"> <input type="submit" value="浏览活动信息"> </form> </div> </body> </html>
show.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="Bean.bean" %> <%@ page import="Dao.dao" %> <%@ page import="DBUtil.DBUtils" %> <%@ page import="java.sql.*" %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>社团活动浏览</title> </head> <body> <div align="center"> <form name="form" method="post" action="menu.jsp"> <input type ="submit" value="返回主页"> </form> <table align="center" border="1" width="500"> <tr> <th>活动主题</th> <th>活动目的</th> <th>活动类型</th> <th>活动时间</th> <th>活动地点</th> <th>活动对象</th> <th>活动内容</th> <th>活动安排</th> </tr> <% String sql = "SELECT * FROM `manage`"; Connection conn=DBUtils.getConn(); Statement state=null; ResultSet rs=null; bean tbean=null; try{ state = conn.createStatement(); rs = state.executeQuery(sql); while(rs.next()) { String theme=rs.getString("theme"); String goal=rs.getString("goal"); String type=rs.getString("type"); String time=rs.getString("time"); String whe=rs.getString("whe"); String object =rs.getString("object"); String content=rs.getString("content"); String arrange =rs.getString("arrange"); out.println("<tr>"+"<td>"+theme+"</td>"); out.println("<td>"+goal+"</td>"); out.println("<td>"+type+"</td>"); out.println("<td>"+time+"</td>"); out.println("<td>"+whe+"</td>"); out.println("<td>"+object+"</td>"); out.println("<td>"+content+"</td>"); out.println("<td>"+arrange+"</td>"+"</tr>"); } }catch(Exception e) { e.printStackTrace(); } finally{ DBUtils.close(rs,state,conn); } %> </body> </html>
show1.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.util.List" %> <%@ page import="Bean.bean" %> <%@ page import="Dao.dao" %> <%@ page import="DBUtil.DBUtils" %> <%@ page import="java.sql.*" %> <%@ page isELIgnored="false"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>浏览结果</title> </head> <title>社团活动浏览</title> </head> <body> <div align="center"> <form name="form" method="post" action="menu.jsp"> <input type="submit" value="返回主页"> </form> <table align="center" border="1" width="500"> <tr> <th>活动主题</th> <th>活动目的</th> <th>活动类型</th> <th>活动时间</th> <th>活动地点</th> <th>对象</th> <th>活动内容</th> <th>活动安排</th> </tr> <% List<bean> list =(List<bean>)request.getAttribute("Bean"); int i=list.size(); for(int k=0;k<i;k++) {out.print("<tr>"); bean p=list.get(k); out.println("<td>"+p.getTheme()+"</td>"+"<td>"+p.getGoal()+"</td>"+"<td>"+p.getType()+"</td>"+ "<td>"+p.getTime()+"</td>"+"<td>"+p.getWhe()+"</td>"+"<td>"+p.getObject()+"</td>"+"<td>"+p.getContent()+"</td>"+"<td>"+p.getArrange()+"</td>"); out.print("</tr>"); out.print("<br>"); %> <p> <% } %>
标签:活动,String,期中考试,req,theme,bean,已经,public,遗忘 From: https://www.cnblogs.com/jiacheng-712/p/16943031.html