JSP中使用使用後臺參數

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);
#取不到值,清緩存



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章