package com.jwy.action;
import java.awt.Color;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.jwy.dao.ICourseDao;
import com.jwy.dao.ISpecialtyDao;
import com.jwy.dto.Course;
import com.jwy.dto.Specialty;
import com.jwy.dto.StuUser;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class StatInfoAction extends DispatchAction {
private ISpecialtyDao specialtyDao;
private ICourseDao courseDao;
/**
* @param specialtyDao
* the specialtyDao to set
*/
public void setSpecialtyDao(ISpecialtyDao specialtyDao) {
this.specialtyDao = specialtyDao;
}
/**
* @param courseDao
* the courseDao to set
*/
public void setCourseDao(ICourseDao courseDao) {
this.courseDao = courseDao;
}
/**
* 按照专业编号,课程名称,授课教师姓名进行搜索
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward findBySearch(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List<Specialty> sList = specialtyDao.findByAll();
Map<String, String> map = new HashMap<String, String>();
if (request.getParameter("specialtyId") != null
&& !request.getParameter("specialtyId").equals("-1")) {
map.put("specialtyId", request.getParameter("specialtyId"));
}
if (request.getParameter("name") != null
&& !request.getParameter("name").equals("")) {
map.put("name", request.getParameter("name"));
}
if (request.getParameter("teacherName") != null
&& !request.getParameter("teacherName").equals("")) {
map.put("teacherName", request.getParameter("teacherName"));
}
List<Object[]> clist = courseDao.findByStat(map);
request.setAttribute("sList", sList);
request.setAttribute("cList", clist);
return mapping.findForward("showStat");
}
/**
* 跟据课程编号查询选择该门课程的学生
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward stuList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Integer specialtyId = Integer.valueOf(request
.getParameter("specialtyId"));
Specialty specialty = specialtyDao.findById(specialtyId);// 专业信息
Integer courseId = Integer.valueOf(request.getParameter("courseId"));
List<Object[]> list = courseDao.findSelectStu(courseId);
Course course = courseDao.findByID(courseId);
System.out.println(courseId);
request.setAttribute("specialty", specialty);
request.setAttribute("stuList", list);
request.setAttribute("course", course);
return mapping.findForward("stuList");
}
/**
* 将上课学生名单导出PDF文档
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward exPDF(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Integer specialtyId = Integer.valueOf(request.getParameter("specialtyId"));
Specialty specialty = specialtyDao.findById(specialtyId);// 专业信息
Integer courseId = Integer.valueOf(request.getParameter("courseId"));
List<Object[]> list = courseDao.findSelectStu(courseId);
Course course = courseDao.findByID(courseId);
response.setContentType("text/html;charset=GBK");
response.setContentType("application/xml");
response.setHeader("Content-Disposition", "attachment;filename="
+ new String(course.getName().getBytes(), "iso-8859-1")+".pdf");
OutputStream outs = response.getOutputStream(); // 获取输出流
Document document = new Document(PageSize.A4);
PdfWriter.getInstance(document, outs);
document.open();
// 设置中文字体
BaseFont bfChinese = BaseFont.createFont("STSong-Light",
"UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
Font t1 = new Font(bfChinese, 20, Font.BOLD); // 设置一级标题字体
Font t2 = new Font(bfChinese, 15, Font.BOLD); // 设置二级标题字体
Font f1 = new Font(bfChinese, 12, Font.NORMAL); // 设置正文字体
Paragraph pragraph = new Paragraph(
specialty.getEnterYear() + "届" + specialty.getLangthYear()
+ "年制" + specialty.getName() + "专业", t1);
pragraph.setAlignment(Paragraph.ALIGN_CENTER);
document.add(pragraph);
pragraph = new Paragraph(course.getName() + "课程听课人员名单"+" 听课总人数:"+list.size()+" 人", t2);
pragraph.setAlignment(Paragraph.ALIGN_CENTER);
document.add(pragraph);
pragraph = new Paragraph("授课教师" + course.getTeacherName(), t2);
pragraph.setAlignment(Paragraph.ALIGN_CENTER);
document.add(pragraph);
// 建立一个表格
PdfPTable table = new PdfPTable(4);
table.setSpacingBefore(40f);// 设置表格上面空白宽度
// 生成表头
String[] bt = new String[] { "学生姓名", "学号", "性别", "联系电话" };
for (int i = 0; i < bt.length; i++) {
PdfPCell cell = new PdfPCell(new Paragraph(bt[i], f1)); // 建立一个单元格
cell.setBackgroundColor(Color.GRAY);
cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 设置内容水平居中显示
cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 设置垂直居中
table.addCell(cell);
}
for (int i = 0; i < list.size(); i++) {
Object[] o = list.get(i);
StuUser stuUser = (StuUser) o[0];
PdfPCell nameCell = new PdfPCell(new Paragraph(stuUser.getStuName(), f1)); // 建立一个单元格
nameCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 设置内容水平居中显示
nameCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 设置垂直居中
PdfPCell stuNoCell = new PdfPCell(new Paragraph(stuUser.getStuNo(),f1)); // 建立一个单元格
stuNoCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 设置内容水平居中显示
stuNoCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 设置垂直居中
PdfPCell stuSexCell = new PdfPCell(new Paragraph(stuUser.getStuSex(), f1)); // 建立一个单元格
stuSexCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 设置内容水平居中显示
stuSexCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 设置垂直居中
PdfPCell telCell = new PdfPCell(new Paragraph(stuUser.getTel(), f1)); // 建立一个单元格
telCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 设置内容水平居中显示
telCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 设置垂直居中
table.addCell(nameCell);
table.addCell(stuNoCell);
table.addCell(stuSexCell);
table.addCell(telCell);
}
document.add(table);
document.close();
outs.close();
return null;
}
/**
* 将上课学生信息导出为Excel文档
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward exExcel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
Integer specialtyId = Integer.valueOf(request.getParameter("specialtyId"));
Specialty specialty = specialtyDao.findById(specia
没有合适的资源?快使用搜索试试~ 我知道了~
java web高校学生选课系统项目源码+程序说明文件.zip
共138个文件
jar:28个
jsp:24个
java:21个
需积分: 9 3 下载量 77 浏览量
2023-03-21
14:36:21
上传
评论 1
收藏 12.98MB ZIP 举报
温馨提示
系统介绍 对于高校学生选课系统来说,针对的用户一般为学生,所以根据用户的需求,要求高校学生选课系统界面设计美观大方、操作简捷灵活,同时在该系统中用户要求必须实现课程信息的具体管理,学生查看历史选课情况,学生注册和选课,已选课学生信息的统计功能。 操作注意事项 本系统的后台用户名为:mr,密码为:mrsoft
资源推荐
资源详情
资源评论
收起资源包目录
java web高校学生选课系统项目源码+程序说明文件.zip (138个子文件)
StatInfoAction.class 10KB
StuUserAction.class 5KB
CourseDao.class 5KB
CourseAction.class 4KB
StuUserDao.class 4KB
UserLoginAction.class 3KB
UserLoginDao.class 3KB
Course.class 3KB
RegAction.class 3KB
SpecialtyAction.class 3KB
UpdatePwdAction.class 3KB
StuUser.class 2KB
SpecialtyDao.class 2KB
CharacterEncodingFilter.class 2KB
Specialty.class 2KB
UserLogin.class 2KB
StuCourse.class 1KB
ICourseDao.class 791B
IUserLoginDao.class 485B
IStuUserDao.class 459B
ISpecialtyDao.class 419B
.classpath 2KB
org.eclipse.wst.jsdt.ui.superType.container 49B
css.css 1KB
style.css 944B
Thumbs.db 22KB
程序使用说明.doc 76KB
topM.gif 75KB
topU.gif 53KB
bottomM.gif 18KB
mainU.gif 18KB
bottomU.gif 17KB
liftU.gif 11KB
addCourse.gif 3KB
addSpecialty.gif 3KB
spring.jar 2.81MB
hibernate3.jar 2.64MB
poi-3.2-FINAL-20081019.jar 1.36MB
iText-2.1.3.jar 1.02MB
mysql-connector-java-5.1.6-bin.jar 687KB
commons-collections.jar 558KB
struts.jar 537KB
javassist-3.4.GA.jar 460KB
antlr-2.7.6.jar 433KB
spring-webmvc.jar 393KB
standard.jar 384KB
log4j-1.2.15.jar 383KB
iTextAsian.jar 322KB
dom4j-1.6.1.jar 307KB
hibernate-annotations.jar 273KB
jaxen-1.1-beta-7.jar 222KB
commons-beanutils.jar 184KB
commons-digester.jar 164KB
commons-dbcp.jar 119KB
hibernate-entitymanager.jar 116KB
hibernate-commons-annotations.jar 65KB
commons-pool.jar 61KB
commons-logging.jar 59KB
spring-webmvc-struts.jar 36KB
jstl.jar 20KB
slf4j-api-1.5.0.jar 16KB
jta.jar 13KB
slf4j-log4j12-1.5.0.jar 9KB
StatInfoAction.java 11KB
StuUserAction.java 5KB
CourseAction.java 4KB
CourseDao.java 4KB
StuUserDao.java 3KB
UserLoginDao.java 3KB
UserLoginAction.java 3KB
Course.java 2KB
StuUser.java 2KB
SpecialtyAction.java 2KB
RegAction.java 2KB
SpecialtyDao.java 2KB
UpdatePwdAction.java 2KB
Specialty.java 1KB
UserLogin.java 1KB
CharacterEncodingFilter.java 1KB
StuCourse.java 831B
ICourseDao.java 660B
IStuUserDao.java 513B
IUserLoginDao.java 507B
ISpecialtyDao.java 475B
topNo.jpg 215KB
index.jpg 130KB
jiantou.jpg 19KB
.jsdtscope 500B
addStuInfo.jsp 5KB
welcome.jsp 4KB
showStat.jsp 4KB
addCourse.jsp 3KB
reg.jsp 3KB
showCourse.jsp 3KB
courseInfo.jsp 3KB
stuUpdatePwd.jsp 3KB
courseInfo.jsp 3KB
addSpecialty.jsp 3KB
select.jsp 3KB
updatePwd.jsp 2KB
共 138 条
- 1
- 2
资源评论
阿星先森
- 粉丝: 139
- 资源: 1453
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- main.c
- Unity 创建快捷方式自动启动
- 一分钟一条原创视频,蹭热点撸收益,条条爆款,狂撸各大平台,轻松日入1000+-教程网盘链接提取码下载 .txt
- 51单片机实现万年历,包括闹钟的设置与秒表功能(汇编)
- STM32单片机FPGA毕设电路原理论文报告铁合金电炉单片机电力监控系统的研究
- STM32单片机FPGA毕设电路原理论文报告贴片元件封装机的智能控制系统设计
- STM32单片机FPGA毕设电路原理论文报告体育高考投篮自动测试系统的设计与实现
- STM32单片机FPGA毕设电路原理论文报告提高放疗精度的单片机控制方法
- C++ matplot学习及demo实操
- STM32单片机FPGA毕设电路原理论文报告提高单晶炉加热电源控制电路精度的研究
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功