火车车次信息管理试题

本试题使用Jsp+Spring+Mybatis+Mysql+Maven等技术实现火车车次信息管理。

题目:火车车次信息管理

语言和环境

A、实现语言
Java
B、环境要求
JDK1.8、Eclipse、Tomcat7、Spring、Mybatis、Mysql、Maven

功能要求

使用JSP+Servlet+Spring+Mybatis实现火车车次信息管理功能,MySql作为后台数据库,功能包括车次信息浏览、火车车次信息详情和车次信息删除两大功能。具体要求如下:
(1)打开火车车次信息管理首页,以列表方式显示所有车次信息,页面列表要求实现隔行变色效果,如下图所示。


(2)单击“删除”链接可以进行火车车次信息删除,如果没有复选框被选中,当单击“删除”链接时需要提示“请选择车次!”信息,如下图所示。

(3)如果选中复选框,单击“删除”链接,执行删除车次信息操作,并根据删除结果给出相应的信息提示,如下图所示。
点击确定后,跳转至车次信息列表页面,并显示更新后的车次列表信息,如下图所示。

(4)单击车次超链接,则跳转至指定车次的火车车次详情页面,如下图所示。

数据库设计

数据库表名称及要求:

视频讲解及源码地址

https://download.csdn.net/download/pcbhyy/10763118

主要代码

数据库

create table train_info(train_no varchar(30) primary key,start_station varchar(30) not null,arrival_station varchar(30) not null,start_time varchar(30) not null,arrival_time varchar(30) not null,type varchar(30) not null,runtime varchar(30) not null,mile double(10,1)  not null
)INSERT INTO `train_info` VALUES ('D73', '沈阳', '深圳', '10-24-16:40', '10-25-20:08', '特快', '20', '2000');
INSERT INTO `train_info` VALUES ('D74', '沈阳', '阜新', '10-24-16:40', '10-25-20:08', '特快', '2', '200');
INSERT INTO `train_info` VALUES ('D75', '沈阳', '北京', '10-24-16:40', '10-25-20:08', '高铁', '4', '1000');INSERT INTO `train_info` VALUES ('D123', '沈阳北', '北京', '10:40', '16:05', '动车', '3d', '500');
INSERT INTO `train_info` VALUES ('G388', '沈阳北', '锦州', '16:40', '07:05', '高铁', '1d', '300');
INSERT INTO `train_info` VALUES ('k388', '沈阳北', '重庆北', '16:40', '07:05', '快', '39d', '1500');
INSERT INTO `train_info` VALUES ('K6206', '沈阳北', '成都北', '16:40', '07:05', '快', '39d', '1500');
INSERT INTO `train_info` VALUES ('Z17', '沈阳北', '北京北', '16:40', '09:05', '直达', '9d', '500');

Servlet

package com.yy.servlet;import java.io.IOException;
import java.util.List;import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;import com.yy.eitity.TrainInfo;
import com.yy.service.TrainInfoService;public class TrainInfoServlet extends HttpServlet {  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {request.setCharacterEncoding("utf-8");String method = request.getParameter("method");if("getTrainInfo".equals(method)) {doGetTrainInfo(request,response);}else if("getTrainById".equals(method)) {doGetTrainById(request,response);}else if("dels".equals(method)) {doDels(request,response);}}private void doDels(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String[] nos = request.getParameterValues("no");ServletContext sc = request.getServletContext();WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(sc);TrainInfoService service = context.getBean(TrainInfoService.class);int n = service.batchDelete(nos);doGetTrainInfo(request,response);     }private void doGetTrainById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String no = request.getParameter("no");ServletContext sc = request.getServletContext();WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(sc);TrainInfoService service = context.getBean(TrainInfoService.class);TrainInfo info = service.getById(no);request.setAttribute("train", info);request.getRequestDispatcher("/WEB-INF/train/getTrain.jsp").forward(request, response);      }private void doGetTrainInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {ServletContext sc = request.getServletContext();WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(sc);TrainInfoService service = context.getBean(TrainInfoService.class);List<TrainInfo> list = service.getAll();request.setAttribute("list", list);request.getRequestDispatcher("/WEB-INF/train/getall.jsp").forward(request, response);      }protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doGet(request, response);}
}

mapper接口

package com.yy.mapper;import java.util.List;import com.yy.eitity.TrainInfo;public interface TrainInfoMapper {public List<TrainInfo> getAll();public TrainInfo getById(String no);public int batchDelete(String[] nos);
}

mapper

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yy.mapper.TrainInfoMapper"><resultMap type="com.yy.eitity.TrainInfo" id="basicMap"><id property="trainNo" column="train_no" /><result property="arrivalStation" column="arrival_Station"/><result property="arrivalTime" column="arrival_Time"/><result property="mile" column="mile"/><result property="runtime" column="runtime"/><result property="startStation" column="start_Station"/><result property="startTime" column="start_Time"/><result property="type" column="type"/></resultMap><select id="getAll" resultMap="basicMap">select * from train_info</select><select id="getById" resultMap="basicMap">select * from train_info where train_no = #{trainNo}</select><delete id="batchDelete">delete from train_info where train_no in<foreach collection="array" item="trainNo" open="(" close=")" separator=",">#{trainNo}</foreach></delete>
</mapper>

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.yy</groupId><artifactId>spring_demo</artifactId><version>0.0.1-SNAPSHOT</version><packaging>war</packaging><build><resources><resource><directory>src/main/java</directory><excludes><exclude>**/*.java</exclude></excludes></resource><resource><directory>src/main/resources</directory></resource></resources><plugins><!-- 资源文件拷贝插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>2.7</version><configuration><encoding>UTF-8</encoding></configuration></plugin><!-- java编译插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.2</version><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version><configuration><!-- 部署路径,如:/e3mall,表明部署到/e3mall路径下 --><path>/</path><!-- 端口号 --><port>8089</port></configuration></plugin></plugins></build><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>4.3.8.RELEASE</version></dependency><dependency><groupId>aopalliance</groupId><artifactId>aopalliance</artifactId><version>1.0</version></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>1.8.10</version></dependency><dependency><groupId>commons-dbcp</groupId><artifactId>commons-dbcp</artifactId><version>1.4</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.6</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>4.3.8.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>4.3.8.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>4.3.8.RELEASE</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.2.6</version></dependency><dependency><groupId>cglib</groupId><artifactId>cglib</artifactId><version>3.2.5</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>1.2.2</version></dependency><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency><!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version><scope>provided</scope></dependency><!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api --><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.2</version><scope>provided</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>4.3.8.RELEASE</version></dependency></dependencies>
</project>

火车车次信息管理试题讲解相关推荐

  1. javaweb火车车次信息管理+文件_厦门火车站启动“双十一”电商黄金周运输 投入列车数量为历年新高...

    为了应对"双十一"期间的快件高峰,厦门火车站也已经进入了备战"双十一"的状态.记者从厦门火车站了解到,从昨天11月1日开始,铁路启动"双十一" ...

  2. java点击车次显示详情_Web项目专项训练——火车车次信息管理系统代码分享

    题目:火车车次信息管理 一.语言和环境 A.实现语言 Java B.环境要求 JDK1.7.Eclipse.Tomcat7.*.mysql 二.功能要求 使用JSP+Servlet实现火车车次信息管理 ...

  3. Web项目专项训练——火车车次信息管理系统代码分享

    题目:火车车次信息管理 一.语言和环境 A.实现语言 Java B.环境要求 JDK1.7.Eclipse.Tomcat7.*.mysql 二.功能要求 使用JSP+Servlet实现火车车次信息管理 ...

  4. 计算机中专综合知识,湖南省汨罗市职业中专高考(八)计算机应用专业综合知识试题讲解.doc...

    湖南省汨罗市职业中专高考(八)计算机应用专业综合知识试题讲解 湖南省汨罗市职业中专2014届高考 计算机应用类专业综合知识试题(八) 一.单项选择题(在每小题的四个备选答案中选出一个正确答案,并将正确 ...

  5. 2021.09 电子学会 - 软件编程(图形化)试题讲解

    软件编程(图形化)试题讲解 一级 考核目标 考查对软件编程界面的认识和基本操作:能够导入角色.背景和声音,通过对角色和背景进行简单操作,编写一个具有简单顺序结构的作品:同时考查简单的逻辑推理能力. 插 ...

  6. OCP 042全真试题讲解

    OCP 042全真试题讲解 小布作品:OCP 042全真试题讲解 - 1 小布作品:OCP 042全真试题讲解 - 2 小布作品:OCP 042全真试题讲解 - 3 转载于:https://blog. ...

  7. 30道经典SQL面试题讲解(11-20)

    本篇节选自书籍<对比Excel,轻松学习SQL数据分析>一书,主要讲解数据分析面试中常见的30道SQL面试题.1-10题见:30道经典SQL面试题讲解(1-10) 11 行列互换 现在我们 ...

  8. [bbk4343]小布-OCP 042全真试题讲解

    参考视频: [bbk4343]小布-OCP 042全真试题讲解 1.You are in the middle of a transaction and very crucial data has b ...

  9. java火车票售票系统,火车购票系统,系统实现了用户会员管理、火车车次管理、火车座位管理、系统公告管理、火车票退票、火车票换乘、换乘查询、直达查询、乘车人管理、订单管理、个人中心管理等

    火车票售票系统 java火车票售票系统,系统实现了用户会员管理.火车车次管理.火车座位管理.系统公告管理.火车票退票.火车票换乘.换乘查询.直达查询.乘车人管理.订单管理.个人中心管理等. 数据库采用 ...

最新文章

  1. 2022-2028年中国演出市场深度调研与发展前景报告
  2. 利用委托和泛型实现树的常用操作
  3. oracle 查询reference,ORACLE高级查询之MODEL PART3
  4. java中substring的用法
  5. JZOJ 5396. 【NOIP2017提高A组模拟10.6】Blocks
  6. 闲鱼如何在2个月内实现Android启动速度翻倍的?
  7. CSS 实现 0.5px 边框线
  8. 广州电子厂房净化工程_简述设计电子车间净化工程的注意要点
  9. java编程思想学习(3):Java中的private、protected、public和default的区别
  10. 米的换算单位和公式_小学三年级数学常用公式和单位换算,孩子复习宝典!
  11. 无法启动SQL Server 2005中的SQL Server(MSSQLSERVER)服务--zt
  12. leetcode题库10--正则表达式匹配
  13. 「动手学深度学习」在B站火到没谁,加这个免费实操平台,妥妥天花板
  14. 【引用】使用CommonDialog的ShowSave后如何判断是保存还是取消?
  15. bzoj2763 [JLOI2011]飞行路线
  16. Thinking in Java 9.6 适配接口
  17. 请问两个div之间的上下距离怎么设置
  18. 微信小程序添加使用外部字体
  19. 浏览器的历史浏览记录_如何在任何浏览器中清除历史记录
  20. 如何使用WiFi的WPS功能

热门文章

  1. Codeforces722E Research Rover dp+逆元+前缀和
  2. 智能家居控制面板:让AI技术为您的家庭带来更多智能化服务
  3. LevelDb(一):LevelDb简介
  4. 便捷的日志收集和分析工具TFA
  5. 一键还原精灵 v5.0 个人版 是什么
  6. Python学习笔记(二):列表、元组和字典章节练习题
  7. Android通过网络URL获取图片并显示
  8. Oracle VM VirtualBox Host热键设置
  9. 【Keras-MLP】IMDb
  10. C ++杀死了我的祖父-C ++很难,C ++编码器隐藏在哪里?