JSP中 post url地址重写or action如何实现
求解在JSP中 post url地址${ctx}/web/webuser_getRights 这个是获取导航JSON。
${ctx}是应用地址知道。后面/web/webuser_getRights这段是如何实现的。
例:url = "${ctx }/adminWx/wxHtml_focusRep";
真实地址:/admin/wechat/focusRep.jsp
(纯前端后台小白请轻喷(●´∀`))
$.post("${ctx}/web/webuser_getRights",function(data){
var result = data.status;
var html="";
for (var i = 0; i < result.length; i++) {
var children = "";
for (var j = 0; j < result[i].children.length; j++) {
children += "<li><a href='${ctx}/"+result[i].children[j].url+"' id='a_"+result[i].children[j].parent+result[i].children[j].rights+"'>"+result[i].children[j].name+"</a></li>";
}
html += "<li><a href='javascript:void(0)'><span class='sidebar-nav-item'>"+result[i].father.name+"</span></a>"+
"<ul class='collapse' style='height: 0px'>"+children+" </ul></li>";
}
function addHtml(obj){
var url = "";
if(obj=="1"){
url = "${ctx }/adminWx/wxHtml_focusRep";
}
if(obj=="2"){
url ="${ctx }/adminWx/wxHtml_defaultRep";
}
if(obj=="3"){
url ="${ctx }/adminWx/wxHtml_keyWordRep";
}
$.post(url,function(data){
$("#content-right").html(data);
});
}
末末的鸭鸭
9 years, 7 months ago