没有合适的资源?快使用搜索试试~ 我知道了~
1.1 旅 1.2 旅 1.1 旅 1.1.1 知识 1.1.2 视频详 1.1.3 总结 1.1.4 课堂提 1.1.5 习题答案 1.1.6 视频缺 1.1
资源详情
资源评论
资源推荐
JavaWeb
day27_综合案例 3
0.1 学习目标
能够完成线路查询功能
能够完成线路详情功能
0.2 学习指南
能够完成线路查询功能(重要)
能够完成线路详情功能(重要)
第一堂课
本节知识点
1.1 旅游线路查询_参数传递
1.2 旅游线路查询_后台代码
本节目标
完成旅游线路
1.1 旅游线路查询_参数传递
1.1.1
知识概述
$("#search-button").click(function () {
//线路名称
var rname = $("#search_input").val();
var cid = getParameter("cid");
// 跳转路径
http://localhost/travel/route_list.html?cid=5,拼接上
rname=xxx
location.href="http://localhost/travel/route_list.html?ci
d="+cid+"&rname="+rname;
});
1.1.2
视频详情
1.1.3 总结与补充
无
1.1.4
课堂提问与练习
无
1.1.5 习题答案
无
1.1.6
视频缺陷
无
1.1.7 视频扩展
无
1.2 旅游线路查询_后台代码
1.2.1
知识概述
@WebServlet("/route/*")
public class RouteServlet extends BaseServlet {
private RouteService routeService = new
RouteServiceImpl();
/**
* 分页查询
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void pageQuery(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
//1.接受参数
String currentPageStr =
request.getParameter("currentPage");
String pageSizeStr =
request.getParameter("pageSize");
String cidStr = request.getParameter("cid");
//接受 rname 线路名称
String rname = request.getParameter("rname");
rname = new
String(rname.getBytes("iso-8859-1"),"utf-8");
int cid = 0;//类别 id
//2.处理参数
if(cidStr != null && cidStr.length() > 0){
cid = Integer.parseInt(cidStr);
}
int currentPage = 0;//当前页码,如果不传递,则默认为第一
页
if(currentPageStr != null &&
currentPageStr.length() > 0){
currentPage = Integer.parseInt(currentPageStr);
}else{
currentPage = 1;
}
int pageSize = 0;//每页显示条数,如果不传递,默认每页显示
5 条记录
if(pageSizeStr != null && pageSizeStr.length() > 0){
pageSize = Integer.parseInt(pageSizeStr);
}else{
pageSize = 5;
}
//3. 调用 service 查询 PageBean 对象
PageBean<Route> pb = routeService.pageQuery(cid,
currentPage, pageSize,rname);
//4. 将 pageBean 对象序列化为 json,返回
writeValue(pb,response);
剩余26页未读,继续阅读
高工-老罗
- 粉丝: 20
- 资源: 314
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0