jsp的EL表达式

一、//获取参数值java

${param.name}jsp

二、//下拉框Option。EL表达式能够写在Dom元素里面spa

<c:forEach items="${wechatInfos}" var="wechatInfo">.net

<option value="${wechatInfo.wechatId}"code

<c:if test="${param.wechatId==wechatInfo.wechatId}"> selected </c:if>>${wechatInfo.wechatName}</option>对象

</c:forEach>blog

三、Servlet/Struts2/SpringMvc传递值到Js中接受。(List对象)字符串

3.一、先在后台把对象封装为JSONArrayget

    JSONArray array = new JSONArray();
    WeixinUserInfo w1 = new WeixinUserInfo();
    WeixinUserInfo w2 = new WeixinUserInfo();
    w1.setCity("武汉");
    w2.setCity("天门");
    array.add(w1);
    array.add(w2);
    request.setAttribute("list1", array);

3.二、在Js中把JSON字符串转为JSON对象it

(其余转换方式http://my.oschina.net/u/2472104/admin/edit-blog?blog=640207)

    var list1 = '${list1}';
    var obj1 = eval(list1);

3.二、结果

上面是直接获取list集合,若是在js中就是对应的全类名的字符串

下面是JSON转换后的集合对象。

四、jsp页面接受后台的值(至关于直接在页面输出一个字符串)

<%= AppConfigUtils.getConfig().getString("system.themes", "default")%>

五、<jsp:include page="/hollycrm/personoa/page/index"></jsp:include>

注意<jsp:include>不能用${ctx}的绝对路径

相关文章
相关标签/搜索