基于javaweb+mysql的jsp+servlet旅游管理系统(java+jsp+javascript+servlet+struts+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的JSP+Servlet旅游管理系统(java+jsp+javascript+servlet+struts+mysql)
项目介绍
本项目包含前后台,前台为普通用户登录,后台为管理员登录;
管理员角色包含以下功能:
管理员登陆,管理员管理,网站公告管理,酒店和旅行社管理,宾馆信息管理,用户信息管理,预定信息管理,留言管理,宾馆预定管理等功能。
用户角色包含以下功能: 用户注册,用户登陆,景点介绍,酒店信息查看,旅行社查看,留言板,宾馆预定,宾馆预订管理,个人中心管理等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:否;
技术栈
1.后端:servlet+struts 2.前端:JSP+CSS+JavaScript+jsp+mysql
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中util/DBO.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录 管理员账号/密码:admin/admin 用户账号/密码: user/123456
try{
String username2 = (String)session.getAttribute("user");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
String check[] = request.getParameterValues("checkit");
if(check == null){
request.setAttribute("message", "请选择要删除的记录!");
request.getRequestDispatcher(sysdir+"/guestbook/index.jsp").forward(request, response);
}
else{
int id[]= new int[check.length];
for(int i = 0;i<check.length;i++){
int s = Integer.parseInt(check[i]);
id[i] = s;
}
int flag = guestBookBean.delGuestBook(id);
if(flag == Constant.SUCCESS){
request.getRequestDispatcher(sysdir+"/guestbook/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/guestbook/index.jsp").forward(request, response);
}
}
}
}catch(Exception e){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
else if(method.equals("replay")){//回复留言
try{
String username2 = (String)session.getAttribute("user");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
String messageid = Filter.escapeHTMLTags(request.getParameter("id").trim());
String replay = Filter.escapeHTMLTags(request.getParameter("replay").trim());
int flag = guestBookBean.reGuestBook(Integer.parseInt(messageid), replay, username2);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "回复成功!");
throws ServletException, IOException {
request.setCharacterEncoding(Constant.CHARACTERENCODING);
response.setContentType(Constant.CONTENTTYPE);
String sysdir = new SystemBean().getDir();
HttpSession session = request.getSession();
String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
try{
String username2 = (String)session.getAttribute("user");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
String method = null;
NewsBean newsBean = new NewsBean();
HzpBean tb=new HzpBean();
SmartUpload mySmartUpload = new SmartUpload();//init
int count = 0;
try{
mySmartUpload.initialize(config,request,response);
mySmartUpload.upload();
method = mySmartUpload.getRequest().getParameter("method").trim();
if(method.equals("ADDNEWS")){//增加新闻
String title = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("title").trim());
String ifhide = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("ifhide").trim());
String content = mySmartUpload.getRequest().getParameter("infoContent");
if(content.length()>8000){
request.setAttribute("message", "对不起,新闻内容不能超过8000个字符!");
request.setAttribute("method", method);
request.getRequestDispatcher(sysdir+"/news/edit.jsp").forward(request, response);
}
else{
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/upload_file/news";
count = mySmartUpload.save(path);
if(file.getFilePathName().trim().equals("")){//如果无缩略图
int flag = newsBean.addNews(title, "无",content, username2, ifhide);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "增加新闻成功!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
}
else{
int flag = newsBean.addNews(title, path+"/"+file.getFileName(),content, username2, ifhide);
if(flag == Constant.SUCCESS){
public class NewsAction extends HttpServlet {
private ServletConfig config;
/**
* Constructor of the object.
*/
public NewsAction() {
super();
}
final public void init(ServletConfig config) throws ServletException
{
this.config = config;
}
final public ServletConfig getServletConfig()
{
return config;
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
String username2 = (String)session.getAttribute("user");
String method = request.getParameter("method").trim();
if(method.equals("addNews")){
String title = request.getParameter("title");
String fenlei = request.getParameter("fenlei");
String infoContent = request.getParameter("infoContent");
int flag = new NewsBean().exeUp("insert into news(title,fenlei,content,addtime,adder,visit) " +
"values('"+title+"','"+fenlei+"','"+infoContent+"','"+date+"','"+username2+"','0')");
if(flag == Constant.SUCCESS){
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
}
else if(method.equals("upNews")){
String id = request.getParameter("id");
String title = request.getParameter("title");
String fenlei = request.getParameter("fenlei");
String infoContent = request.getParameter("infoContent");
int flag = new NewsBean().exeUp("update news set title='"+title+"',fenlei='"+fenlei+"',content='"+infoContent+"' where id='"+id+"'");
if(flag == Constant.SUCCESS){
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
}
else if(method.equals("delNews")){
String id = request.getParameter("id");
int flag = new NewsBean().exeUp("delete from news where id='"+id+"'");
if(flag == Constant.SUCCESS){
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
}
else if(method.equals("addPrep")){
String member=(String)session.getAttribute("member");
String sid = request.getParameter("sid");
String title = request.getParameter("title");
String rs = request.getParameter("rs");
String sj = request.getParameter("sj");
String ts = request.getParameter("ts");
String lxr = request.getParameter("lxr");
String lxfs = request.getParameter("lxfs");
int flag = new NewsBean().exeUp("insert into prep(title,rs,sj,ts,lxr,lxfs,addtime,member) " +
"values('"+title+"','"+rs+"','"+sj+"','"+ts+"','"+lxr+"','"+lxfs+"','"+date+"','"+member+"')");
if(flag == Constant.SUCCESS){
throw new IllegalArgumentException("There is no specified destination file (1140).");
}
if(s.equals(""))
{
throw new IllegalArgumentException("There is no specified destination file (1140).");
}
if(s.lastIndexOf("\\") >= 0)
{
s1 = s.substring(0,s.lastIndexOf("\\"));
s2 = s.substring(s.lastIndexOf("\\") + 1);
}
if(s.lastIndexOf("/") >= 0)
{
s1 = s.substring(0,s.lastIndexOf("/"));
s2 = s.substring(s.lastIndexOf("/") + 1);
}
s1 = s1.length() != 0 ? s1 : "/";
java.io.File file = new java.io.File(s1);
if(file.exists())
{
flag = true;
}
if(i == 0)
{
if(isVirtual(s1))
{
s1 = m_application.getRealPath(s1);
if(s1.endsWith(s3))
{
s1 = s1 + s2;
}
else
{
s1 = s1 + s3 + s2;
}
return s1;
}
if(flag)
{
if(m_denyPhysicalPath)
String sj = request.getParameter("sj");
String ts = request.getParameter("ts");
String lxr = request.getParameter("lxr");
String lxfs = request.getParameter("lxfs");
int flag = new NewsBean().exeUp("insert into prep(title,rs,sj,ts,lxr,lxfs,addtime,member) " +
"values('"+title+"','"+rs+"','"+sj+"','"+ts+"','"+lxr+"','"+lxfs+"','"+date+"','"+member+"')");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "预订成功,稍后本站客服人员会与您取得联系。您可以在会员中心查看您的预订记录!");
request.getRequestDispatcher("index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("index.jsp").forward(request, response);
}
}
else if(method.equals("delPrep")){
String id = request.getParameter("id");
int flag = new NewsBean().exeUp("delete from prep where id='"+id+"'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/prep/prep.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/prep/prep.jsp").forward(request, response);
}
}
}catch(Exception e){
e.printStackTrace();
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}
/**
* 上传控制servlet中无法实现的功能由此操作
*
* 通用操作控制
*
*/
else{
String check[] = request.getParameterValues("checkit");
if(check == null){
request.setAttribute("message", "请选择要删除的记录!");
request.getRequestDispatcher(sysdir+"/system/log.jsp").forward(request, response);
}
else{
int id[]= new int[check.length];
for(int i = 0;i<check.length;i++){
int s = Integer.parseInt(check[i]);
id[i] = s;
}
int flag = loginbean.delLog(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "删除记录成功!");
request.getRequestDispatcher(sysdir+"/system/log.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/system/log.jsp").forward(request, response);
}
}
}
}
else{//无参数传入转到错误页面
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}catch(Exception e){
e.printStackTrace();
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
{
throw new SmartUploadException("Unable to upload.");
}
}
for(;!flag1 && m_currentIndex < m_totalBytes;m_currentIndex++)
{
if(m_binArray[m_currentIndex] == 13)
{
flag1 = true;
}
else
{
m_boundary = m_boundary + (char)m_binArray[m_currentIndex];
}
}
if(m_currentIndex == 1)
{
return;
}
for(m_currentIndex++;m_currentIndex < m_totalBytes;m_currentIndex = m_currentIndex + 2)
{
long now=new java.util.Date().getTime();
String s1 = getDataHeader();
m_currentIndex = m_currentIndex + 2;
boolean flag3 = s1.indexOf("filename") > 0;
String s3 = getDataFieldValue(s1,"name");
if(flag3)
{
s6 = getDataFieldValue(s1,"filename");
s4 = now+getFileName(s6);
s5 = getFileExt(s4);
s7 = getContentType(s1);
s8 = getContentDisp(s1);
s9 = getTypeMIME(s7);
s10 = getSubTypeMIME(s7);
}
getDataSection();
if(flag3 && s4.length() > 0)
{
if(m_deniedFilesList.contains(s5))
{
throw new SecurityException("The extension of the file is denied to be uploaded (1015).");
}
if(!m_allowedFilesList.isEmpty() && !m_allowedFilesList.contains(s5))
/**
* Constructor of the object.
*/
public MemberManageAction() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @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 doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @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 {
response.setContentType(Constant.CONTENTTYPE);
request.setCharacterEncoding(Constant.CHARACTERENCODING);
String sysdir = new SystemBean().getDir();
HttpSession session = request.getSession();
try{
String username2 = (String)session.getAttribute("user");
else if(method.equals("tuijiandeltrave")){
String id=request.getParameter("id").trim();
int flag = tb.delTrave(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/hzp/tuijian.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/hzp/tuijian.jsp").forward(request, response);
}
}
else if(method.equals("addType")){
String type=request.getParameter("type").trim();
int flag=tb.addType(type);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/hzp/type.jsp").forward(request, response);
}
else if(flag==Constant.DEFAULT_ERROR){
request.setAttribute("message", "该分类已存在!");
request.getRequestDispatcher("admin/hzp/type.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/hzp/type.jsp").forward(request, response);
}
}
else if(method.equals("delType")){
String id=request.getParameter("id").trim();
int flag=tb.delType(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/hzp/type.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/hzp/type.jsp").forward(request, response);
}
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
public final void initialize(PageContext pagecontext) throws ServletException
{
m_application = pagecontext.getServletContext();
m_request = (HttpServletRequest)pagecontext.getRequest();
m_response = (HttpServletResponse)pagecontext.getResponse();
}
/**
* @deprecated Method initialize is deprecated
*/
public final void initialize(ServletContext servletcontext,HttpSession httpsession,HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse,JspWriter jspwriter) throws ServletException
{
m_application = servletcontext;
m_request = httpservletrequest;
m_response = httpservletresponse;
}
public void upload() throws ServletException,IOException,SmartUploadException
{
int i = 0;
//boolean flag = false;
boolean flag1 = false;
//boolean flag2 = false;
long l = 0L;
//String s = "";//new String();
//String s2 = "";//new String();
String s4 = ""; //new String();
String s5 = ""; //new String();
String s6 = ""; //new String();
String s7 = ""; //new String();
String s8 = ""; //new String();
String s9 = ""; //new String();
String s10 = ""; //new String();
m_totalBytes = m_request.getContentLength();
m_binArray = new byte[m_totalBytes];
int j;
for(;i < m_totalBytes;i += j)
{
try
{
m_request.getInputStream();
j = m_request.getInputStream().read(m_binArray,i,m_totalBytes - i);
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @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 doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @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 {
response.setContentType(Constant.CONTENTTYPE);
request.setCharacterEncoding(Constant.CHARACTERENCODING);
HttpSession session = request.getSession();
MemberBean memberBean = new MemberBean();
String method = Filter.escapeHTMLTags(request.getParameter("method").trim());
/*********************************************
* 会员注册通用(检查用户名 修改密码 reg2.jsp页面跳转)
*********************************************/
if(method.equals("reg2")){//会员注册 reg2.jsp
String username = Filter.escapeHTMLTags(request.getParameter("username").trim());
String password = Filter.escapeHTMLTags(request.getParameter("password").trim());
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @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(Constant.CHARACTERENCODING);
response.setContentType(Constant.CONTENTTYPE);
//nikename, pic, email, qq, weburl, blogurl, expressions, content
String sysdir = new SystemBean().getDir();
HttpSession session = request.getSession();
String method = request.getParameter("method").trim();
GuestBookBean guestBookBean = new GuestBookBean();
if(method.equals("add")){//发表留言
String member=(String)session.getAttribute("member");
String nikename = Filter.escapeHTMLTags(request.getParameter("nikename").trim());
String face ="images/nobody.gif";
String email = Filter.escapeHTMLTags(request.getParameter("email").trim());
String qq = Filter.escapeHTMLTags(request.getParameter("qq").trim());
String weburl = Filter.escapeHTMLTags(request.getParameter("weburl").trim());
String blogurl = Filter.escapeHTMLTags(request.getParameter("blogurl").trim());
String expressions = "images/face/"+Filter.escapeHTMLTags(request.getParameter("face").trim())+".gif";
String content = Filter.escapeHTMLTags(request.getParameter("content").trim());
String ip = request.getRemoteAddr();
int guestbook=1;
int flag = guestBookBean.addGuestBook(nikename, face, email, qq, weburl, blogurl, expressions, content, ip,guestbook);
if(flag == 1){
request.setAttribute("message", "谢谢您的留言,请等候管理员回复!");
request.getRequestDispatcher("guestbook.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("guestbook.jsp").forward(request, response);
}
}
else if(method.equals("delguestbook")){//删除留言
try{
}
else
{
if(s2.length() == 0)
{
m_response.setHeader("Content-Disposition",m_contentDisposition);
}
else
{
m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + s2);
}
}
while((long)k < l)
{
int j = fileinputstream.read(abyte0,0,i);
k += j;
m_response.getOutputStream().write(abyte0,0,j);
}
fileinputstream.close();
}
public void downloadField(ResultSet resultset,String s,String s1,String s2) throws ServletException,IOException,SQLException
{
if(resultset == null)
{
throw new IllegalArgumentException("The RecordSet cannot be null (1045).");
}
if(s == null)
{
throw new IllegalArgumentException("The columnName cannot be null (1050).");
}
if(s.length() == 0)
{
throw new IllegalArgumentException("The columnName cannot be empty (1055).");
}
byte abyte0[] = resultset.getBytes(s);
if(s1 == null)
{
m_response.setContentType("application/x-msdownload");
}
else
{
if(s1.length() == 0)
{
m_response.setContentType("application/x-msdownload");
}
else
{
m_response.setContentType(s1);
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
/**
* MyEclipse Struts
* Creation date: 05-05-2010
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class HzpsAction extends Action {
/*
}
}
}
else if(method.equals("editnews")){//修改新闻
String id = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("id").trim());
String title = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("title").trim());
String ifhide = Filter.escapeHTMLTags(mySmartUpload.getRequest().getParameter("ifhide").trim());
String content = mySmartUpload.getRequest().getParameter("infoContent");
SmartFile file = mySmartUpload.getFiles().getFile(0);
String fileExt=file.getFileExt();
String path="/upload_file/news";
count = mySmartUpload.save(path);
if(file.getFilePathName().trim().equals("")){//如果不修改缩略图
int flag = newsBean.updateNews(Integer.parseInt(id), title, content, username2, ifhide);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "修改新闻成功!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
}
else{//如果修改缩略图
int flag = newsBean.updateNewsWithPic(Integer.parseInt(id), title, path+"/"+file.getFileName(), content, username2, ifhide);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "修改新闻成功!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
}
}
宾馆
else if(method.equals("addlvyou")){//增加
/**
* String title = "";
String dz="";
String yb="";
String dh="";
String jd="";
String content="";
*/
String title = mySmartUpload.getRequest().getParameter("title");
String dz = mySmartUpload.getRequest().getParameter("dz");
String yb = mySmartUpload.getRequest().getParameter("yb");
String dh = mySmartUpload.getRequest().getParameter("dh");
String jd = mySmartUpload.getRequest().getParameter("jd");
String content = mySmartUpload.getRequest().getParameter("infoContent");
if(content == null) {
content = "";
else if(method.equals("delNews")){
String id = request.getParameter("id");
int flag = new NewsBean().exeUp("delete from news where id='"+id+"'");
if(flag == Constant.SUCCESS){
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
}
else if(method.equals("addPrep")){
String member=(String)session.getAttribute("member");
String sid = request.getParameter("sid");
String title = request.getParameter("title");
String rs = request.getParameter("rs");
String sj = request.getParameter("sj");
String ts = request.getParameter("ts");
String lxr = request.getParameter("lxr");
String lxfs = request.getParameter("lxfs");
int flag = new NewsBean().exeUp("insert into prep(title,rs,sj,ts,lxr,lxfs,addtime,member) " +
"values('"+title+"','"+rs+"','"+sj+"','"+ts+"','"+lxr+"','"+lxfs+"','"+date+"','"+member+"')");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "预订成功,稍后本站客服人员会与您取得联系。您可以在会员中心查看您的预订记录!");
request.getRequestDispatcher("index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("index.jsp").forward(request, response);
}
}
else if(method.equals("delPrep")){
String id = request.getParameter("id");
int flag = new NewsBean().exeUp("delete from prep where id='"+id+"'");
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/prep/prep.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/prep/prep.jsp").forward(request, response);
}
}
}catch(Exception e){
e.printStackTrace();
}
}
/**
* Initialization of the servlet. <br>
*