zoukankan      html  css  js  c++  java
  • SSH电力项目九--运行监控首页显示

    需求:在首页显示出设备运行情况,并去掉<br>换行符,每隔十分钟刷新一次页面。

    ElecMenuAction.java

    首先注入运行监控service

    public class ElecMenuAction extends BaseAction<MenuForm>{
    
        MenuForm menuForm = this.getModel();
        //注入运行监控service
        @Resource(name=IElecCommonMsgService.SERVICE_NAME)
       IElecCommonMsgService elecCommonMsgService;
    
    }

    然后再查询监控内容

    /**
         * @Name:alermStation
         * @Description:站点运行情况
         * @Author:康捷
         * @Version:V1.00
         *  @create Date:20170521
         * @return :String: 跳转到menu/alermStation.jsp
         */
        public String alermStation(){
    //        1.查询数据库运行监控表的数据,返回唯一的ElecCommonMsg 
            ElecCommonMsg ecm = elecCommonMsgService.findCommonMsg();
    //            2.将ElecCommonMsg对象压入栈顶,支持表单回显    
    //        ServletActionContext.getContext().getValueStack().push(ecm);   //  后边有复用,写到公用方法中去
            ValueUtils.putValueStack(ecm);
            return "alermStation";
        }
        /**
         * @Name:alermDevice
         * @Description:设备运行情况
         * @Author:康捷
         * @Version:V1.00
         *  @create Date:20170521
         * @return :String: 跳转到menu/alermDevice.jsp
         */
        public String alermDevice(){
    //        1.查询数据库运行监控表的数据,返回唯一的ElecCommonMsg 
            ElecCommonMsg ecm = elecCommonMsgService.findCommonMsg();
    //            2.将ElecCommonMsg对象压入栈顶,支持表单回显    
    //        ServletActionContext.getContext().getValueStack().push(ecm);   //  后边有复用,写到公用方法中去
            ValueUtils.putValueStack(ecm);
            return "alermDevice";
        }

     对应的页面:

    alermStation.jsp 和 alermDevice.jsp  其中,

    <s:date name="createDate"     format="yyyy-MM-dd HH:mm:ss" /> 用来显示日期格式
    <s:property value="stationRun" escapeHtml="false"/> 去掉显示<br>内容
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ taglib uri="/struts-tags" prefix="s" %>
    <html>
      <head>
        <title>load</title>
        <link href="${pageContext.request.contextPath }/css/Style.css" type="text/css" rel="stylesheet" />
       </head>
      <body>
        <table width="100%" border="0" id="table8">
                    <tr>
                        <td align="left" valign="middle"  style="word-break: break-all">
                        <span class="style1">
                        <s:property value="stationRun" escapeHtml="false"/>
                        </span></td>
                    </tr>        
        
                    <tr>
                        <td align="left" valign="middle"  style="word-break: break-all">
                        <span class="style1">
                        <font color="red"><s:date name="createDate"     format="yyyy-MM-dd HH:mm:ss" /></font>
                        </span></td>
                    </tr>    
                    
        </table>
      </body>
    </html>

    每隔十分钟刷新页面:

    <script>
        /**添加10分钟后自动刷新页面,站点和设备运行的实时性*/
        window.onload=function(){
            setTimeout('refresh10()',1000*60*10) ;
        }
        function refresh10(){
            window.location.reload();
        }
    </script>
  • 相关阅读:
    关于软件开发代码的纯洁问题
    乱七八糟
    苹果屏幕变化问题
    注意
    eclipse juno创建maven web项目目录生成方法
    Verilog HDL建模(四)
    Verilog HDL建模(三)
    Verilog HDL建模(二)
    Verilog HDL建模(五)
    Verilog HDL的建模学习(一)
  • 原文地址:https://www.cnblogs.com/taiguyiba/p/6885273.html
Copyright © 2011-2022 走看看