基于javaweb+mysql的jsp+servlet在线旅游路线商城系统(java+jsp+javascript+servlet+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的JSP+Servlet在线旅游路线商城系统(java+jsp+javascript+servlet+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项目:否;
技术栈
JSP+CSS+JavaScript+java+servlet+mysql
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中src/com/hr/dao/Basedao.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入http://localhost:8080/ 登录 管理员账号/密码:admin/admin 用户账号/密码:user/123456
StrategyInfoemation twoStrategyInfoemation=new StrategyInfoemation();
twoStrategyInfoemation.setStatus(Constant.isUsd);
twoStrategyInfoemation.setCreateTime(new Date());
twoStrategyInfoemation.setStrategyAccommodation(attractionsDto.getTwoAccommodation());
twoStrategyInfoemation.setStrategyDays(2);
twoStrategyInfoemation.setSceneId(sceneInformation.getId());
twoStrategyInfoemation.setStrategyIntroduce(attractionsDto.getTwoIntroduce());
twoStrategyInfoemation.setStrategySite(attractionsDto.getTwoSite());
twoStrategyInfoemation.setStrategyTraffic(attractionsDto.getTwoTraffic());
strategyInfoemationService.insert(twoStrategyInfoemation);
twoStrategyInfoemation=null;
if(StringUtils.isNotEmpty(attractionsDto.getThreeSite())){
StrategyInfoemation threeStrategyInfoemation=new StrategyInfoemation();
sceneCollection.setSceneId(retSceneInformation.getId());
sceneCollection.setSceneName(retSceneInformation.getSceneName());
sceneCollection.setCreateTime(new Date());
sceneCollection.setStatus(Constant.isUsd);
Integer count= sceneCollectionService.insert(sceneCollection);
if(count >0){
logger.info("收藏成功");
}else{
flag=false;
}catch(Throwable te){
flag=false;
threeStrategyInfoemation.setStrategyIntroduce(attractionsDto.getThreeIntroduce());
threeStrategyInfoemation.setStrategySite(attractionsDto.getThreeSite());
threeStrategyInfoemation.setStrategyTraffic(attractionsDto.getThreeTraffic());
strategyInfoemationService.insert(threeStrategyInfoemation);
threeStrategyInfoemation=null;
}else{
flag=false;
}catch(Throwable te){
flag=false;
logger.error("保存景点信息异常信息为:", te);
sb.append("\r\n");
json.put("sb", sb);
return json;
@RequestMapping("/savecomments")
@ResponseBody
public JSONObject savecomments(HttpServletRequest request,HttpServletResponse response,String commentsContent,String sceneId){
SceneComments sceneComments =new SceneComments();
JSONObject json=new JSONObject();
boolean flag=true;
String userName="";
try{
sceneComments.setCreateTime(new Date());
JSONObject json=new JSONObject();
try{
if(null != request.getSession()){
if(null != request.getSession().getAttribute("tourismUser")){
userName=request.getSession().getAttribute("tourismUser").toString();
Map<String, Object> map=new HashMap<>();
Map<String, Object> strategyInfoemationMap=new HashMap<>();
map.put("user_name", userName);
List<SceneCollection> list=sceneCollectionService.selectByMap(map);
if(null != list && list.size() >0){
// 初始化返回码和返回信息,默认处理成功
ResponseInformation responseInformation=new ResponseInformation();
logger.info("保存用户信息为:"+JSONObject.toJSONString(tourismUser));
try {
tourismUser.setCreateTime(new Date());
tourismUser.setStatus(Constant.isUsd);
Integer count= tourismUserService.insert(tourismUser);
if (count > 0) {
logger.info("保存成功");
}else{
responseInformation.setReponseCode(Constant.dataCode);
responseInformation.setReponseMessage("数据异常");
list= sceneInformationService.selectByMap(null);
return list;
@RequestMapping("/selectSceneDetail")
public String selectSceneDetail(ModelMap map,String id){
SceneInformation sceneInformation = sceneInformationService.selectById(id);
map.put("sceneInformation",sceneInformation);
return "tourismWeb/senceDetail";
@RequestMapping("/selectSceneCommentsAll")
@ResponseBody
public JSONObject selectSceneCommentsAll(String id){
StringBuffer sb = new StringBuffer();
JSONObject json=new JSONObject();
return json;
@RequestMapping("/savecomments")
@ResponseBody
public JSONObject savecomments(HttpServletRequest request,HttpServletResponse response,String commentsContent,String sceneId){
SceneComments sceneComments =new SceneComments();
JSONObject json=new JSONObject();
boolean flag=true;
String userName="";
try{
sceneComments.setCreateTime(new Date());
if(null != request.getSession()){
if(null != request.getSession().getAttribute("tourismUser")){
userName=request.getSession().getAttribute("tourismUser").toString();
strategyInfoemation.setSceneId(Integer.parseInt(saveSceneCollectionDto.getSceneId()));
strategyInfoemation.setCreateTime(new Date());
strategyInfoemation.setStatus(Constant.isUsd);
strategyInfoemationService.insert(strategyInfoemation);
}else{
falg=false;
}catch(Throwable te){
falg=false;
te.printStackTrace();
json.put("flag", falg);
return json;
@RequestMapping("/editUser")
public String editUser(){
strategyInfoemationService.insert(twoStrategyInfoemation);
twoStrategyInfoemation=null;
if(StringUtils.isNotEmpty(attractionsDto.getThreeSite())){
StrategyInfoemation threeStrategyInfoemation=new StrategyInfoemation();
threeStrategyInfoemation.setStatus(Constant.isUsd);
threeStrategyInfoemation.setCreateTime(new Date());
threeStrategyInfoemation.setStrategyAccommodation(attractionsDto.getThreeAccommodation());
threeStrategyInfoemation.setStrategyDays(3);
threeStrategyInfoemation.setSceneId(sceneInformation.getId());
threeStrategyInfoemation.setStrategyIntroduce(attractionsDto.getThreeIntroduce());
threeStrategyInfoemation.setStrategySite(attractionsDto.getThreeSite());
threeStrategyInfoemation.setStrategyTraffic(attractionsDto.getThreeTraffic());
strategyInfoemationService.insert(threeStrategyInfoemation);
threeStrategyInfoemation=null;
List<StrategyInfoemation> strategyInfoemation =strategyInfoemationService.selectByMap(strategyInfoemationMap);
json.put("strategyInfoemation",strategyInfoemation);
}else{
json.put("sceneInformation",null);
json.put("strategyInfoemation", null);
}else{
json.put("sceneInformation",null);
json.put("strategyInfoemation", null);
}catch(Throwable te){
te.printStackTrace();
return json;
@RequestMapping("/updateSeceneCollection")
private SearchRecordService searchRecordService;
@RequestMapping("/checkLogin")
@ResponseBody
public JSONObject checkLogin(HttpServletRequest request,HttpServletResponse response,String userName,String passWord){
logger.info("收到的用户名为:"+userName+",密码为:"+passWord);
JSONObject json=new JSONObject();
if(userName.equals("admin") && passWord.equals("123456")){
request.getSession().setAttribute("userName","admin");
json.put("fiag", true);
}else{
json.put("fiag", false);
return json;
@RequestMapping("/jumpMain")
public JSONObject checkLogin(HttpServletRequest request,HttpServletResponse response,String userName,String passWord){
logger.info("收到的用户名为:"+userName+",密码为:"+passWord);
JSONObject json=new JSONObject();
TourismUser tourismUser =new TourismUser();
tourismUser.setStatus(Constant.isUsd);
tourismUser.setUserArount(userName);
tourismUser.setUserPassword(passWord);
TourismUser retTourismUser = tourismUserService.selectOne(tourismUser);
if(null != retTourismUser){
request.getSession().setAttribute("tourismUser",retTourismUser.getUserName());
json.put("fiag", true);
map.put("sceneInformation",sceneInformation);
return "tourismWeb/senceDetail";
@RequestMapping("/selectSceneCommentsAll")
@ResponseBody
public JSONObject selectSceneCommentsAll(String id){
StringBuffer sb = new StringBuffer();
JSONObject json=new JSONObject();
Map<String, Object> map=new HashMap<>();
map.put("scene_id",id);
List<SceneComments> list=sceneCommentsService.selectByMap(map);
if(null != list && list.size() >0){
list= sceneInformationService.selectByMap(null);
return list;
@RequestMapping("/selectSceneDetail")
public String selectSceneDetail(ModelMap map,String id){
SceneInformation sceneInformation = sceneInformationService.selectById(id);
map.put("sceneInformation",sceneInformation);
return "tourismWeb/senceDetail";
@RequestMapping("/selectSceneCommentsAll")
@ResponseBody
public JSONObject selectSceneCommentsAll(String id){
StringBuffer sb = new StringBuffer();
@RequestMapping("/savecomments")
@ResponseBody
public JSONObject savecomments(HttpServletRequest request,HttpServletResponse response,String commentsContent,String sceneId){
SceneComments sceneComments =new SceneComments();
JSONObject json=new JSONObject();
boolean flag=true;
String userName="";
try{
sceneComments.setCreateTime(new Date());
if(null != request.getSession()){
if(null != request.getSession().getAttribute("tourismUser")){
TourismUser tourismUser =new TourismUser();
tourismUser.setStatus(Constant.isUsd);
tourismUser.setUserArount(userName);
tourismUser.setUserPassword(passWord);
TourismUser retTourismUser = tourismUserService.selectOne(tourismUser);
if(null != retTourismUser){
request.getSession().setAttribute("tourismUser",retTourismUser.getUserName());
json.put("fiag", true);
}else{
json.put("fiag", false);
return json;
map.put("sceneInformation",sceneInformation);
return "tourismWeb/senceDetail";
@RequestMapping("/selectSceneCommentsAll")
@ResponseBody
public JSONObject selectSceneCommentsAll(String id){
StringBuffer sb = new StringBuffer();
JSONObject json=new JSONObject();
Map<String, Object> map=new HashMap<>();
map.put("scene_id",id);
List<SceneComments> list=sceneCommentsService.selectByMap(map);
if(null != list && list.size() >0){
for(int i=0;i<list.size();i++){
sb.append("评论人:"+list.get(i).getCommentsName());