package controller;
import Jdbcdao.RoomDao;
import hotel.Hotel;
import hotel.Order;
import services.Hotelservice;
import services.Orderservice;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
@WebServlet(name = "Ordercontroller", value = "/Order/*")
public class Ordercontroller extends HttpServlet {
Hotelservice hotelservice=new Hotelservice();
Orderservice orderservice=new Orderservice();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url= request.getRequestURI();
Order order=new Order();
if(url.equals("/test5_war/Order/form")){
List<Hotel> hotelist=new ArrayList();
String[] ids=request.getParameterValues("selectedrooms");
for(String id:ids){
Hotel hotel= hotelservice.gethotelbyid(id);
if(hotel!=null) {
hotelist.add(hotel);
}
}
request.setAttribute("hotelist",hotelist);
request.getRequestDispatcher("../Dingdan.jsp").forward(request,response);
}
if(url.equals("/test5_war/Order/submit")){
String ordername=request.getParameter("name");
if(orderservice.insert(ordername)>=0)
{
request.setAttribute("name",ordername);
request.getRequestDispatcher("../success.jsp").forward(request,response);
}
}
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
test5_QQ浏览器压缩包.zip (78个子文件)
test5
test5.iml 2KB
pom.xml 2KB
src
test
resources
java
main
resources
java
services
Hotelservice.java 337B
Orderservice.java 322B
controller
Ordercontroller.java 2KB
Hotelcontroller.java 1KB
Jdbcdao
RoomDao.java 1KB
JdbcDao.java 1KB
OrderDao.java 325B
hotel
Hotel.java 564B
Order.java 441B
DatabaseConnection.java 2KB
webapp
WEB-INF
lib
mysql-connector-j-9.0.0.jar 2.47MB
web.xml 304B
web.xml 648B
Dingdan.jsp 1KB
success.jsp 1KB
hotel.jsp 1KB
login.jsp 307B
.idea
jarRepositories.xml 864B
dataSources
462aafab-465e-4b84-8df3-26ac0dfa10c4
storage_v2
_src_
schema
performance_schema.kIw0nw.meta 76B
sys.zb4BAA.meta 61B
information_schema.FNRwLQ.meta 76B
mysql.osA4Bg.meta 63B
462aafab-465e-4b84-8df3-26ac0dfa10c4.xml 39KB
dataSources.local.xml 1002B
sql
mysql.jar 524KB
runConfigurations.xml 346B
artifacts
test5_war_exploded.xml 919B
test5_war.xml 556B
libraries
mysql__2_.xml 218B
Maven__org_junit_jupiter_junit_jupiter_api_5_7_1.xml 594B
Maven__org_junit_jupiter_junit_jupiter_engine_5_7_1.xml 615B
Maven__org_junit_platform_junit_platform_commons_1_7_1.xml 633B
mysql.xml 206B
Maven__org_apiguardian_apiguardian_api_1_1_0.xml 572B
Maven__javax_servlet_javax_servlet_api_4_0_1.xml 578B
Maven__org_opentest4j_opentest4j_1_2_0.xml 533B
mysql_connector_j_9_0_0.xml 268B
Maven__org_junit_platform_junit_platform_engine_1_7_1.xml 626B
mysql_connector_j_9_0.xml 1KB
workspace.xml 11KB
misc.xml 596B
dataSources.xml 545B
compiler.xml 637B
modules.xml 257B
.gitignore 190B
encodings.xml 360B
target
classes
DatabaseConnection.class 2KB
services
Hotelservice.class 705B
Orderservice.class 506B
controller
Ordercontroller.class 3KB
Hotelcontroller.class 2KB
Jdbcdao
JdbcDao.class 2KB
RoomDao.class 3KB
OrderDao.class 755B
hotel
Hotel.class 1KB
Order.class 794B
test5-1.0-SNAPSHOT
WEB-INF
classes
DatabaseConnection.class 2KB
services
Hotelservice.class 705B
Orderservice.class 506B
controller
Ordercontroller.class 3KB
Hotelcontroller.class 2KB
Jdbcdao
JdbcDao.class 2KB
RoomDao.class 3KB
OrderDao.class 755B
hotel
Hotel.class 1KB
Order.class 794B
lib
mysql-connector-j-9.0.0.jar 2.47MB
mysql.jar 524KB
web.xml 304B
web.xml 648B
Dingdan.jsp 1KB
success.jsp 1KB
META-INF
MANIFEST.MF 100B
hotel.jsp 1KB
login.jsp 307B
test5-1.0-SNAPSHOT.war 2.82MB
generated-sources
annotations
共 78 条
- 1
资源评论
Rannagisa
- 粉丝: 0
- 资源: 0
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功