小白成长之路_今天学到的(2016.7.27)



thymeleaf 的应用

自定义属性的方法比如:th:attr="data-uid=${li.uid},data-eid=${li.eid},data-ename=${li.ename},data-uname=${li.uname}"

再在jquery中获取比如:     var eid = $(this).find(".guidename").attr("data-eid");
var uid = $(this).find(".guidename").attr("data-uid");
var ename = $(this).find(".guidename").attr("data-ename");
var uname = $(this).find(".guidename").attr("data-uname");

用th:each循环显示的div,怎么获取指定的某一个

比如:

$(".aaaaa").click(function (){

var eid = $(this).find(".guidename").attr("data-eid");

});


thymeleaf 的应用

自定义属性的方法比如:th:attr="data-uid=${li.uid},data-eid=${li.eid},data-ename=${li.ename},data-uname=${li.uname}"

再在jquery中获取比如:     var eid = $(this).find(".guidename").attr("data-eid");
var uid = $(this).find(".guidename").attr("data-uid");
var ename = $(this).find(".guidename").attr("data-ename");
var uname = $(this).find(".guidename").attr("data-uname");


前台同步传多个参数到后台Cotroller就是多加几个/{xxx}/{xxx}

比如:

$(function (){
$(".list-group-item").click(function(){
var eid = $(this).find(".guidename").attr("data-eid");
var uid = $(this).find(".guidename").attr("data-uid");
var ename = $(this).find(".guidename").attr("data-ename");
var uname = $(this).find(".guidename").attr("data-uname");
window.location.href = "../Reservation/view/" + eid + "/" + uid + "/" + ename + "/" + uname;
});
});


@RequestMapping(value = "Reservation/view/{eid}/{uid}/{ename}/{uname}")
public ModelAndView toReservationView(@PathVariable String eid,@PathVariable String uid,@PathVariable String ename,@PathVariable String uname,Model model){
Guides gs = new Guides();
gs.setEid(eid);
gs.setUid(uid);
gs.setEname(ename);
gs.setUname(uname);
model.addAttribute("list", gs);
return new ModelAndView("common/wx/reservation");
}


thymeleaf 的应用

自定义属性的方法比如:th:attr="data-uid=${li.uid},data-eid=${li.eid},data-ename=${li.ename},data-uname=${li.uname}"

再在jquery中获取比如:     var eid = $(this).find(".guidename").attr("data-eid");
var uid = $(this).find(".guidename").attr("data-uid");
var ename = $(this).find(".guidename").attr("data-ename");
var uname = $(this).find(".guidename").attr("data-uname");

你可能感兴趣的:(工作日志)