基于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
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
}
/**
* 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 {
{
downloadFile(s,s1,s2,65000);
}
public void downloadFile(String s,String s1,String s2,int i) throws ServletException,IOException,SmartUploadException
{
if(s == null)
{
throw new IllegalArgumentException("File '" + s + "' not found (1040).");
}
if(s.equals(""))
{
throw new IllegalArgumentException("File '" + s + "' not found (1040).");
}
if(!isVirtual(s) && m_denyPhysicalPath)
{
throw new SecurityException("Physical path is denied (1035).");
}
if(isVirtual(s))
{
s = m_application.getRealPath(s);
}
java.io.File file = new java.io.File(s);
FileInputStream fileinputstream = new FileInputStream(file);
long l = file.length();
//boolean flag = false;
int k = 0;
byte abyte0[] = new byte[i];
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);
}
}
m_response.setContentLength((int)l);
m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
if(s2 == null)
{
m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s));
}
else
*/
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();
String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
try{
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");
else if(method.equals("DELALLUSE")){//来自所有在用会员页面
request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
}
}
else{
if(method.equals("DELMEMBER")){//来自所有个人会员页面
request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
}
else if(method.equals("DELCO")){//来自所有企业会员页面
request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
}
else if(method.equals("DELTODAY")){//来自今日注册会员页面
request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
}
else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
}
else if(method.equals("DELALLUSE")){//来自所有在用会员页面
request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
}
}
}
}
else if(method.equals("CLOSE")){
String id=request.getParameter("id").trim();
int flag=mmBean.closeMember(Integer.parseInt(id));
if(flag==Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
}
}
else{
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
}catch(Exception e){
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
}
/**
* 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.
*
public void downloadFile(String s) throws ServletException,IOException,SmartUploadException
{
downloadFile(s,null,null);
}
public void downloadFile(String s,String s1) throws ServletException,IOException,SmartUploadException,SmartUploadException
{
downloadFile(s,s1,null);
}
public void downloadFile(String s,String s1,String s2) throws ServletException,IOException,SmartUploadException
{
downloadFile(s,s1,s2,65000);
}
public void downloadFile(String s,String s1,String s2,int i) throws ServletException,IOException,SmartUploadException
{
if(s == null)
{
throw new IllegalArgumentException("File '" + s + "' not found (1040).");
}
if(s.equals(""))
{
throw new IllegalArgumentException("File '" + s + "' not found (1040).");
}
if(!isVirtual(s) && m_denyPhysicalPath)
{
throw new SecurityException("Physical path is denied (1035).");
}
if(isVirtual(s))
{
s = m_application.getRealPath(s);
}
java.io.File file = new java.io.File(s);
FileInputStream fileinputstream = new FileInputStream(file);
long l = file.length();
//boolean flag = false;
int k = 0;
byte abyte0[] = new byte[i];
if(s1 == null)
{
m_response.setContentType("application/x-msdownload");
}
int s = Integer.parseInt(check[i]);
id[i] = s;
}
int flag = mmBean.delMember(id);
if(flag == Constant.SUCCESS){
if(method.equals("DELMEMBER")){//来自所有个人会员页面
request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
}
else if(method.equals("DELCO")){//来自所有企业会员页面
request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
}
else if(method.equals("DELTODAY")){//来自今日注册会员页面
request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
}
else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
}
else if(method.equals("DELALLUSE")){//来自所有在用会员页面
request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
}
}
else{
if(method.equals("DELMEMBER")){//来自所有个人会员页面
request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
}
else if(method.equals("DELCO")){//来自所有企业会员页面
request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
}
else if(method.equals("DELTODAY")){//来自今日注册会员页面
request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
}
else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
}
else if(method.equals("DELALLUSE")){//来自所有在用会员页面
request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
}
}
}
}
else if(method.equals("CLOSE")){
String id=request.getParameter("id").trim();
int flag=mmBean.closeMember(Integer.parseInt(id));
if(flag==Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
}
public int getSize()
{
return m_totalBytes;
}
public byte getBinaryData(int i)
{
byte byte0;
try
{
byte0 = m_binArray[i];
}
catch(Exception exception)
{
throw new ArrayIndexOutOfBoundsException("Index out of range (1005).");
}
return byte0;
}
public SmartFiles getFiles()
{
return m_files;
}
public SmartRequest getRequest()
{
return m_formRequest;
}
public void downloadFile(String s) throws ServletException,IOException,SmartUploadException
{
downloadFile(s,null,null);
}
public void downloadFile(String s,String s1) throws ServletException,IOException,SmartUploadException,SmartUploadException
{
downloadFile(s,s1,null);
}
public void downloadFile(String s,String s1,String s2) throws ServletException,IOException,SmartUploadException
else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
}
else if(method.equals("DELALLUSE")){//来自所有在用会员页面
request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
}
}
else{
if(method.equals("DELMEMBER")){//来自所有个人会员页面
request.getRequestDispatcher(sysdir+"/member/person.jsp").forward(request, response);
}
else if(method.equals("DELCO")){//来自所有企业会员页面
request.getRequestDispatcher(sysdir+"/member/co.jsp").forward(request, response);
}
else if(method.equals("DELTODAY")){//来自今日注册会员页面
request.getRequestDispatcher(sysdir+"/member/today.jsp").forward(request, response);
}
else if(method.equals("DELALLCLOSE")){//来自所有冻结会员页面
request.getRequestDispatcher(sysdir+"/member/close.jsp").forward(request, response);
}
else if(method.equals("DELALLUSE")){//来自所有在用会员页面
request.getRequestDispatcher(sysdir+"/member/using.jsp").forward(request, response);
}
}
}
}
else if(method.equals("CLOSE")){
String id=request.getParameter("id").trim();
int flag=mmBean.closeMember(Integer.parseInt(id));
if(flag==Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/member/person.jsp").forward(request, response);
}
}
else{
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
}catch(Exception e){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
/**
* Initialization of the servlet. <br>
*
*/
public void init() throws ServletException {
// Put your code here
}
}
package com.action;
/**
* 前台会员登录 退出
*
*/
public class LoginAction extends HttpServlet {
/**
* Constructor of the object.
*/
public LoginAction() {
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
*/
downloadFile(s,s1,s2,65000);
}
public void downloadFile(String s,String s1,String s2,int i) throws ServletException,IOException,SmartUploadException
{
if(s == null)
{
throw new IllegalArgumentException("File '" + s + "' not found (1040).");
}
if(s.equals(""))
{
throw new IllegalArgumentException("File '" + s + "' not found (1040).");
}
if(!isVirtual(s) && m_denyPhysicalPath)
{
throw new SecurityException("Physical path is denied (1035).");
}
if(isVirtual(s))
{
s = m_application.getRealPath(s);
}
java.io.File file = new java.io.File(s);
FileInputStream fileinputstream = new FileInputStream(file);
long l = file.length();
//boolean flag = false;
int k = 0;
byte abyte0[] = new byte[i];
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);
}
}
m_response.setContentLength((int)l);
m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
if(s2 == null)
{
m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s));
}
/**
* 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");
if(username2 == null){
if(reg_type.equals("person")){//如果是个人会员
request.getRequestDispatcher("personreg.jsp").forward(request, response);
}
else if(reg_type.equals("co")){//如果是企业会员
request.getRequestDispatcher("coreg.jsp").forward(request, response);
}
else{
request.getRequestDispatcher("index.jsp").forward(request, response);
}
}
else if(flag == Constant.SAME_NAME){
request.setAttribute("username", username);
request.setAttribute("message", "对不起,该用户名已存在,请重新选择!");
request.getRequestDispatcher("reg2.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("reg2.jsp").forward(request, response);
}
}
}
else if(method.equals("checksame")){//检查注册名是否可用
String username = Filter.escapeHTMLTags(request.getParameter("username").trim());
if(username.trim().equals("admin")){
request.setAttribute("username", username);
request.setAttribute("message", "非法的用户名,请重新选择!");
request.getRequestDispatcher("reg2.jsp").forward(request, response);
}
else{
int flag = memberBean.checkRegName(username);
if(flag == Constant.SUCCESS){
request.setAttribute("username", username);
request.setAttribute("message", "恭喜您,这个名字可以使用!");
request.getRequestDispatcher("reg2.jsp").forward(request, response);
}
else if(flag == Constant.SAME_NAME){
request.setAttribute("username", username);
request.setAttribute("message", "对不起,该用户名已存在,请重新选择!");
request.getRequestDispatcher("reg2.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("reg2.jsp").forward(request, response);
}
}
}
m_response.setContentLength((int)l);
m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";
if(s2 == null)
{
m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s));
}
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)
{
request.setAttribute("message", "系统维护中,请稍后再试!");
return (mapping.findForward("admin/hzp/hot.jsp"));
}
}
else if(method.equals("tejiadeltrave")){
String id=request.getParameter("id").trim();
int flag = tb.delTrave(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
return (mapping.findForward("admin/hzp/tejia.jsp"));
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
return (mapping.findForward("admin/hzp/tejia.jsp"));
}
}
else if(method.equals("tuijiandeltrave")){
String id=request.getParameter("id").trim();
int flag = tb.delTrave(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
return (mapping.findForward("admin/hzp/tuijian.jsp"));
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
return (mapping.findForward("admin/hzp/tuijian.jsp"));
}
}
else if(method.equals("addType")){
String type=request.getParameter("type").trim();
int flag=tb.addType(type);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
return (mapping.findForward("admin/hzp/type.jsp"));
}
else if(flag==Constant.DEFAULT_ERROR){
request.setAttribute("message", "该分类已存在!");
return (mapping.findForward("admin/hzp/type.jsp"));
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
return (mapping.findForward("admin/hzp/type.jsp"));
}
}
else if(method.equals("delType")){
String id=request.getParameter("id").trim();
int flag=tb.delType(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
return (mapping.findForward("admin/hzp/type.jsp"));
}
/**
* 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");
if(username2 == null){
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
String method = request.getParameter("method").trim();
/**********************************************
* 新闻
************************************************/
if(method.equals("DELNEWS")){//删除新闻 来自普通新闻页面index.jsp
String strDirPath = request.getSession().getServletContext().getRealPath("/");
String check[] = request.getParameterValues("checkit");
if(check == null){
* @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());
String reg_type = Filter.escapeHTMLTags(request.getParameter("reg_type").trim());
request.setAttribute("username", username);
request.setAttribute("password", password);
request.setAttribute("reg_type", reg_type);
if(username.trim().equals("admin")){
request.setAttribute("username", username);
request.setAttribute("message", "非法的用户名,请重新选择!");
request.getRequestDispatcher("reg2.jsp").forward(request, response);
}
else{
int flag = memberBean.checkRegName(username);
if(flag == Constant.SUCCESS){
if(reg_type.equals("person")){//如果是个人会员
request.getRequestDispatcher("personreg.jsp").forward(request, response);
}
else if(reg_type.equals("co")){//如果是企业会员
request.getRequestDispatcher("coreg.jsp").forward(request, response);
}
else{
request.getRequestDispatcher("index.jsp").forward(request, response);
}
*/
public class AfficheAction extends HttpServlet {
/**
* Constructor of the object.
*/
public AfficheAction() {
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
{
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)
{
throw new IllegalArgumentException("Physical path is denied (1125).");
}
else
{
return s;
}
}
else
{
throw new IllegalArgumentException("This path does not exist (1135).");
}
}
if(i == 1)
{
if(isVirtual(s1))
{
s1 = m_application.getRealPath(s1);
if(s1.endsWith(s3))
{
s1 = s1 + s2;
}
else
{
s1 = s1 + s3 + s2;
}
*/
public void init() throws ServletException {
// Put your code here
}
}
package com.action;
/**
* 会员注册、修改资料等
*
*/
public class MemberAction extends HttpServlet {
/**
* Constructor of the object.
*/
public MemberAction() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
/**
* Constructor of the object.
*/
public CommonAction() {
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 {
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);
}
}
m_response.setContentLength(abyte0.length);
if(s2 == null)
{
m_response.setHeader("Content-Disposition","attachment;");
}
else
{
if(s2.length() == 0)
{
m_response.setHeader("Content-Disposition","attachment;");
}
else
{
m_response.setHeader("Content-Disposition","attachment; filename=" + s2);
}
}
m_response.getOutputStream().write(abyte0,0,abyte0.length);
}
public void fieldToFile(ResultSet resultset,String s,String s1) throws ServletException,IOException,SmartUploadException,SQLException
{
try
{
if(m_application.getRealPath(s1) != null)
{
s1 = m_application.getRealPath(s1);
}
if(check == null){
request.setAttribute("message", "请选择要删除的记录!");
request.getRequestDispatcher(sysdir+"/news/index.jsp").forward(request, response);
}
else{
int id2[]= new int[check.length];
for(int i = 0;i<check.length;i++){
int s = Integer.parseInt(check[i]);
id2[i] = s;
}
int flag = new NewsBean().delNews(id2);
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("HIDENEWS")){//隐藏、显示新闻 来自普通新闻页面index.jsp
String id = Filter.escapeHTMLTags(request.getParameter("id").trim());
int flag = new NewsBean().hideNews(Integer.parseInt(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("UPNEWS")){//置顶 新闻 来自普通新闻页面index.jsp
String id = Filter.escapeHTMLTags(request.getParameter("id").trim());
int flag = new NewsBean().upNews(Integer.parseInt(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);
}
}
// if(method.equals("DELUPNEWS")){//删除新闻 来自置顶新闻页面up.jsp
// String strDirPath = request.getSession().getServletContext().getRealPath("/");
// String check[] = request.getParameterValues("checkit");
// if(check == null){
// request.setAttribute("message", "请选择要删除的记录!");
// request.getRequestDispatcher(sysdir+"/news/up.jsp").forward(request, response);
// }
// else{
// int id2[]= new int[check.length];
// for(int i = 0;i<check.length;i++){
// int s = Integer.parseInt(check[i]);
// id2[i] = s;
//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);
}
catch(Exception exception)
{
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)
{
}
/**
* 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();
* 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 {
request.setCharacterEncoding(Constant.CHARACTERENCODING);
response.setContentType(Constant.CONTENTTYPE);
HttpSession session=request.getSession();
HzpBean tb=new HzpBean();
String method=request.getParameter("method").trim();
/
if(method.equals("deltrave")){
String id=request.getParameter("id").trim();
int flag = tb.delTrave(id);
if(flag == Constant.SUCCESS){
request.setAttribute("message", "操作成功!");
request.getRequestDispatcher("admin/hzp/index.jsp").forward(request, response);
}
else{
request.setAttribute("message", "系统维护中,请稍后再试!");
request.getRequestDispatcher("admin/hzp/index.jsp").forward(request, response);
}
}