Java EL对象 `${pools}`

标签 java jsp jstl el

我正在尝试调整 PSI Probe 中使用的代码(或者更一般地说,PSI Probe 的想法)将在我公司的 Web 应用程序内部使用。我可以获得我想要做的大部分内容,但我已经陷入了一小部分代码 - “状态”选项卡。一列数据是线程的处理时间,我真的很想拥有这些数据,但我不知道它来自哪里。这是相关片段:

<c:forEach items="${pools}" var="pool" varStatus="poolStatus">
  <div class="poolInfo">
    <h3>${pool.name}</h3>
    <div class="processorInfo">
      <span class="name">
        <spring:message code="probe.jsp.status.processor.maxTime"/>
      </span>
      &nbsp;${pool.maxTime}

我不知道pools对象来自哪里!有人有此类事情的经验吗?谢谢!

最佳答案

查看源代码(这是 Google 代码,Google 搜索速度非常快)

池正在填充 ListThreadPoolsController

List pools = containerListenerBean.getThreadPools();
        return new ModelAndView(getViewName())
                .addObject("pools", pools);

仔细看看ContainerListenerBean

显示 status.jsp 中列出的属性

<span class="name"><spring:message code="probe.jsp.status.currentThreadCount"/></span>&nbsp;${pool.currentThreadCount}
<span class="name"><spring:message code="probe.jsp.status.currentThreadsBusy"/></span>&nbsp;${pool.currentThreadsBusy}
<span class="name"><spring:message code="probe.jsp.status.maxThreads"/></span>&nbsp;${pool.maxThreads}
<span class="name"><spring:message code="probe.jsp.status.maxSpareThreads"/></span>&nbsp;${pool.maxSpareThreads}
<span class="name"><spring:message code="probe.jsp.status.minSpareThreads"/></span>&nbsp;${pool.minSpareThreads}

正在 getThreadPools() 方法中填充

ThreadPool threadPool = new ThreadPool();
threadPool.setName(executorName.getKeyProperty("name"));
threadPool.setMaxThreads(JmxTools.getIntAttr(server, executorName, "maxThreads"));
threadPool.setMaxSpareThreads(JmxTools.getIntAttr(server, executorName, "largestPoolSize"));
threadPool.setMinSpareThreads(JmxTools.getIntAttr(server, executorName, "minSpareThreads"));
threadPool.setCurrentThreadsBusy(JmxTools.getIntAttr(server, executorName, "activeCount"));
threadPool.setCurrentThreadCount(JmxTools.getIntAttr(server, executorName, "poolSize"));

关于Java EL对象 `${pools}`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7639249/

相关文章:

java - 如何知道我们的视频被网站上的任何人下载

java - 无法打到Servlet页面

java - JSTL 消息 : Don't know how to iterate over supplied "items" with forEach

java - 如何在 spring-amqp 中设置 consumer-tag 值

java - 除了 SimpleDateFormat 之外,如何在时间设置上添加一个小时?

java - 消除 Web 开发中的硬编码文件路径和 URL

jsf - 以编程方式获取 JSTL EL Context 的表达式值

java - JSTL形式相对路径

java - JFrame 组件有时无法加载

java - 在单行代码片段中编写并关闭 BufferedWriter