JSP中使用<c:if>使用后台参数

来源:互联网 发布:自动化编程是什么 编辑:程序博客网 时间:2024/05/22 01:34
1)返回list对象中某个对象buyCard某个属性clientState
<c:if test="${buyCard.clientState == null || buyCard.clientState==''}"><input readonly="readonly" value="" class="input_text"></c:if><c:if test="${buyCard.dataStatus == 0}"><input readonly="readonly" value="否" class="input_text"></c:if>


2)获取后台request中的参数(request.setAttribute("isComm", isComm);)<c:if test="${requestScope.isComm}">    <button class="btn_red" id="save">保存</button> </c:if>
这样也可以
<c:if test="${ messageCounts == 0 }">

3)jsp页面获取request的参数

用小脚本写java代码
<%
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("txt1");
%>
html: 得到值 <%=name %>

4)js引用:

<script>

var  x = "<%=name%>;

alert(x);

</script>

5)js引用request传递过来的集合
alert("${otherBuyCards.size()}");
var size ='${otherBuyCards.size()}';alert(size);
#取不到值,清缓存


原创粉丝点击