展开全部
function deleteM(id){
//直接删掉 数据库假删除
/* alert(id);
$ */("#div"+id).remove();
$.ajax({
url:"${pageContext.request.contextPath}/servlet/MenuServlet?method=delete",
data:"id="+id,
success:function(data){
$("#div"+id).remove();
}
});
}
<body>
This is menu selectAll JSP page. <br>
<jsp:include page="/servlet/MenuServlet?method=findAll"></jsp:include>
<p></p>
<div class="table-1">
<div class="tr-1">
<div class="td-1">序号</div>
<div class="td-1">标题</div>
<div class="td-1">连接地址</div>
<div class="td-1">排序</div>
<div class="td-1">录入时间</div>
<div class="td-1">操作</div>
<div class="clear"></div>
</div>
</div>
<c:forEach items="${requestScope.menus }" var="a" varStatus="stat">
<div class="table-1">
<div class="tr-1" id="div${a.id}">
<div class="td-1">${stat.count }</div>
<div class="td-1">${a.title }</div>
<div class="td-1">${a.url}</div>
<div class="td-1">${a.sort }</div>
<div class="td-1" id="timer">${a.inputTime }</div>
<div class="td-1">
<a href="javascript:void(0)" onclick="javascript:deleteM(${a.id})" return false; id="deleteM${a.id}">删除</a>
<a href="javascript:void(0)" onclick="javascript:updateM(${a.id})" return false; id="updateM${a.id}">修改</a>
<a style="display: none;" href="javascript:void(0)" onclick="javascript:submitM(${a.id})" return false;id="okM${a.id}">确定</a>
<a style="display: none;" href="javascript:void(0)" onclick="javascript:cancalM(${a.id})" return false;id="cancalM{a.id}">取消</a>
</div>
<div class="clear"></div>
</div>
</div>
</c:forEach>
<p></p>
<p></p>
<div id="table-1">
<c:forEach begin="1" end="${requestScope.pager.pageCount }" var="i">
<c:if test="${i eq requestScope.pager.pageNo }" var="isPageNo">
<span style="color:black">[${i }]</span>
</c:if>
<c:if test="${not isPageNo }">
<a href="${pageContext.request.contextPath }/manage/menu/selectAll.jsp?pageNo=${i}">[${i }]</a>
</c:if>
</c:forEach>
</div>
<p></p>
<p></p>
<div id="table-1">
<div class="tr-1">
<div class="td-2" ><a href="javascript:void(0)" onclick="javascript:insertM()">添加菜单项</a></div>
<div class="clear"></div>
</div>
</div>
<div id="table-1">
<div class="tr-1">
<div class="td-2" id=titleInsert>标题:<input required /></div>
<div class="td-2" id="urlsInsert">连接地址:<input required /></div>
<div class="td-2" id="sortInsert">排序:<input required onBlur="checkSort()"/></div>
<div class="td-2" ><a href="#" onclick="javascript:insertM();return false;">添加</a>
<a href="javascript:void(0)" onclick="javascript:cancalM2()">取消</a></div>
<div class="clear"></div>
</div>
</div>
<p></p>
<p></p>
<p></p>
<p></p>
<div id="table-1">
<div class="tr-1">
<div class="td-2" ><a href="javascript:void(0)" onclick="javascript:selectM()">我好想找点什么</a></div>
<div class="clear"></div>
</div>
</div>
<div id="table-1">
<div class="tr-1">
<div class="td-2" > <select id="sss" onChange="selectWay()">
<option value="s1"> 按录入时间查找:</option>
<option value="s2"> 按ID查找:</option>
<option value="s3">按排序查找:</option>
</select>
</div>
<div class="td-2" id="selectMByTime">
开始时间:<input type="datetime-local"/>结束时间:<input type="datetime-local"/>
<a href="javascript:void(0)" onclick="javascript:submitM(${a.inputTime})">开找</a>
<a href="javascript:void(0)" onclick="javascript:cancalC(${a.inputTime})">取消</a>
</div>
<div class="td-2" style="display: none;" id="selectMById">
ID:<input type="text" />
<a href="javascript:void(0)" onclick="javascript:submitM(${a.id})">开找</a>
<a href="javascript:void(0)" onclick="javascript:cancalC(${a.id})">取消</a>
</div>
<div class="td-2" style="display: none;" id="selectMBySort">
降序:<input type="radio" name="sort" id="up" checked />倒序:<input type="radio" name="sort" id="desc" />
<a href="javascript:void(0)" onclick="javascript:submitM(${a.sort})">开找</a>
<a href="javascript:void(0)" onclick="javascript:cancalC(${a.sort})">取消</a>
</div>
<div class="td-2" style="display: none;" ></div>
</div>
</div>
</body>
没有js的头`他说字数超限了
//直接删掉 数据库假删除
/* alert(id);
$ */("#div"+id).remove();
$.ajax({
url:"${pageContext.request.contextPath}/servlet/MenuServlet?method=delete",
data:"id="+id,
success:function(data){
$("#div"+id).remove();
}
});
}
<body>
This is menu selectAll JSP page. <br>
<jsp:include page="/servlet/MenuServlet?method=findAll"></jsp:include>
<p></p>
<div class="table-1">
<div class="tr-1">
<div class="td-1">序号</div>
<div class="td-1">标题</div>
<div class="td-1">连接地址</div>
<div class="td-1">排序</div>
<div class="td-1">录入时间</div>
<div class="td-1">操作</div>
<div class="clear"></div>
</div>
</div>
<c:forEach items="${requestScope.menus }" var="a" varStatus="stat">
<div class="table-1">
<div class="tr-1" id="div${a.id}">
<div class="td-1">${stat.count }</div>
<div class="td-1">${a.title }</div>
<div class="td-1">${a.url}</div>
<div class="td-1">${a.sort }</div>
<div class="td-1" id="timer">${a.inputTime }</div>
<div class="td-1">
<a href="javascript:void(0)" onclick="javascript:deleteM(${a.id})" return false; id="deleteM${a.id}">删除</a>
<a href="javascript:void(0)" onclick="javascript:updateM(${a.id})" return false; id="updateM${a.id}">修改</a>
<a style="display: none;" href="javascript:void(0)" onclick="javascript:submitM(${a.id})" return false;id="okM${a.id}">确定</a>
<a style="display: none;" href="javascript:void(0)" onclick="javascript:cancalM(${a.id})" return false;id="cancalM{a.id}">取消</a>
</div>
<div class="clear"></div>
</div>
</div>
</c:forEach>
<p></p>
<p></p>
<div id="table-1">
<c:forEach begin="1" end="${requestScope.pager.pageCount }" var="i">
<c:if test="${i eq requestScope.pager.pageNo }" var="isPageNo">
<span style="color:black">[${i }]</span>
</c:if>
<c:if test="${not isPageNo }">
<a href="${pageContext.request.contextPath }/manage/menu/selectAll.jsp?pageNo=${i}">[${i }]</a>
</c:if>
</c:forEach>
</div>
<p></p>
<p></p>
<div id="table-1">
<div class="tr-1">
<div class="td-2" ><a href="javascript:void(0)" onclick="javascript:insertM()">添加菜单项</a></div>
<div class="clear"></div>
</div>
</div>
<div id="table-1">
<div class="tr-1">
<div class="td-2" id=titleInsert>标题:<input required /></div>
<div class="td-2" id="urlsInsert">连接地址:<input required /></div>
<div class="td-2" id="sortInsert">排序:<input required onBlur="checkSort()"/></div>
<div class="td-2" ><a href="#" onclick="javascript:insertM();return false;">添加</a>
<a href="javascript:void(0)" onclick="javascript:cancalM2()">取消</a></div>
<div class="clear"></div>
</div>
</div>
<p></p>
<p></p>
<p></p>
<p></p>
<div id="table-1">
<div class="tr-1">
<div class="td-2" ><a href="javascript:void(0)" onclick="javascript:selectM()">我好想找点什么</a></div>
<div class="clear"></div>
</div>
</div>
<div id="table-1">
<div class="tr-1">
<div class="td-2" > <select id="sss" onChange="selectWay()">
<option value="s1"> 按录入时间查找:</option>
<option value="s2"> 按ID查找:</option>
<option value="s3">按排序查找:</option>
</select>
</div>
<div class="td-2" id="selectMByTime">
开始时间:<input type="datetime-local"/>结束时间:<input type="datetime-local"/>
<a href="javascript:void(0)" onclick="javascript:submitM(${a.inputTime})">开找</a>
<a href="javascript:void(0)" onclick="javascript:cancalC(${a.inputTime})">取消</a>
</div>
<div class="td-2" style="display: none;" id="selectMById">
ID:<input type="text" />
<a href="javascript:void(0)" onclick="javascript:submitM(${a.id})">开找</a>
<a href="javascript:void(0)" onclick="javascript:cancalC(${a.id})">取消</a>
</div>
<div class="td-2" style="display: none;" id="selectMBySort">
降序:<input type="radio" name="sort" id="up" checked />倒序:<input type="radio" name="sort" id="desc" />
<a href="javascript:void(0)" onclick="javascript:submitM(${a.sort})">开找</a>
<a href="javascript:void(0)" onclick="javascript:cancalC(${a.sort})">取消</a>
</div>
<div class="td-2" style="display: none;" ></div>
</div>
</div>
</body>
没有js的头`他说字数超限了
追问
谢谢
追答
这都不采纳```逗我呢
2018-06-28 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
js与java是不同语言,运行在不同环境下,因此无法直接获得对方数据。
java运行在服务器端,在同一个jsp文件中,java先运行,js后运行,java可以生成一段js代码,保证js运行得到相应的结果,因此可以用java定义js变量的方式来传递数据,例如:
<script>
var url="<%=url%>";
alert(username);
</script>
上面例子,<%%>中的内容会在服务器端运行,在“”中间输出网址,浏览器就会加载下面的结果:
<script>
var url="gif8.cn";
alert(url);
</script>
这部分就是标准的js代码了。
java运行在服务器端,在同一个jsp文件中,java先运行,js后运行,java可以生成一段js代码,保证js运行得到相应的结果,因此可以用java定义js变量的方式来传递数据,例如:
<script>
var url="<%=url%>";
alert(username);
</script>
上面例子,<%%>中的内容会在服务器端运行,在“”中间输出网址,浏览器就会加载下面的结果:
<script>
var url="gif8.cn";
alert(url);
</script>
这部分就是标准的js代码了。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-02-12
展开全部
不能直接取值,可以这样试一下:
可以将值设进网页中,再从网页中取出来,具体如下:
document.getElementById("t").innerHTML =www.javalearns.com;
HTML:<input type="hidden" id="t" name="javalearns"/>
jsp:request.getParameter("javalearns");
可以将值设进网页中,再从网页中取出来,具体如下:
document.getElementById("t").innerHTML =www.javalearns.com;
HTML:<input type="hidden" id="t" name="javalearns"/>
jsp:request.getParameter("javalearns");
追问
谢谢
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用方法get()获取
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
直接取值是做不到的,下面有具体分析
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |