首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring mvc Ajax更新jstl变量--未显示jstl

Spring mvc Ajax更新jstl变量--未显示jstl
EN

Stack Overflow用户
提问于 2012-04-27 02:22:18
回答 1查看 875关注 0票数 0

我正在使用spring mvc开发一个小的web应用程序。我将变量放入视图,然后在前端显示为jstl。在我的主页上,我有

代码语言:javascript
复制
function getExecJob(execid){
alert(execid);
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      document.getElementById("execDetailDiv").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","execJobDetail.action?execId="+execid,true);
xmlhttp.send();

}

execJobDetail.action返回页execJobDetail.jsp,

代码语言:javascript
复制
                    <div id="status_code_div">
                        HTTP Status Code Summary <br/>
                            <table width="523" id="http_status_code_table">
                                    <tr>
                                        <th width="268" >HTTP Status Code</th>
                                        <th width="129" ># of Urls</th>
                                        <th width="110" >%</th>
                                     </tr>
                                    <c:forEach var="entry" items="${reportMap}">
                                    <tr>
                                        <td scope="col" class="row_type"> ${entry.key}</td>
                                        <td scope="col" class="row_value">${entry.value}</td>
                                        <td scope="col" class="row_value">${(entry.value)*1.0/toal}</td>
                                </tr>
                            </c:forEach>
                            </table>
                    </div>
                    </c:if>

但它总是返回页面,将jstl内容留空。有没有人能给我一些建议!谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-27 05:42:28

如果您还没有在JSP之上实际声明JSTL标记库,就会发生这种情况。这样,它既不会被解析,也不会被处理,最终会在生成的HTML输出中成为纯文本。

将以下行添加到JSP顶部,以运行JSTL标记库:

代码语言:javascript
复制
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

另请参阅:

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10339187

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档