基于javaweb+mysql的火车票网上订票系统(前台、后台)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
前台功能:用户查询车票信息、登录注册、购票、查看已购车票、修改密码等功能。
后台功能:管理员管理、用户管理、火车信息管理、站点信息管理、线路信息管理、车票信息管理、购票信息管理等。
后台:
前台
技术框架
JSP Servlet MySQL JDBC Tomcat CSS JavaScript
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
String id=request.getParameter("idi");
String flgs=request.getParameter("flgs");
JSONObject json=new JSONObject();
DbConn db=new DbConn();
if("fk".equals(flgs)){
int bls=db.deleteOrUpdate("update dpiao set lyflag='已付款' where id="+id);
if(bls>0){
json.put("dt", 1);
json.put("msg", "付款成功。");
}else{
json.put("dt", 0);
json.put("msg", "fkerror:01");
}
}else if("gq".equals(flgs)){
//改签
* 读取Properties综合类,默认绑定到temp下的.properties文件。
*/
public class HandleProperties {
//配置文件的路径
private String configPath=null;
/**
* 配置文件对象
*/
private Properties props=null;
/**
* 默认构造函数,用于sh运行,自动找到temp下的.properties。
*/
public HandleProperties(HttpSession session,String fname) throws IOException{
String path=session.getServletContext().getRealPath("/");
File f=new File(path+"prop/"+fname+".properties");
if(!f.exists()){
f.getParentFile().mkdirs();
}
if(!f.exists()){
try {
f.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
var czi=$("#gcz").val();
var xcnumsi=$("#gxcnums").val();
var traintypei=$("#gtraintype").val();
var ids=$("#idi").val();
var flag=$("#flagi").val();
if(tnamei==""||czi==""||znumsi==""||xcnumsi==""){
alert('账户信息不完整。');
return;
}
if("add"==flag