1.登录页面:

将上一节中的页面放到/WEB-INF/page/目录下,需要登录后才能访问该页面:

对应页面:/WEB-INF/page/menu/home.jsp

<%@ page language="java" pageEncoding="UTF-8"%>

<HTML>
<HEAD>
<TITLE>电力监测中心首页</TITLE>
<LINK href="/css/Font.css" type="text/css" rel="stylesheet"> <STYLE>BODY {
SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-BASE-COLOR: #dee3f7
}
</STYLE> <SCRIPT type="text/javascript">
function submitrequest(action){
eval("document.location='"+action+"'");
} </SCRIPT>
</HEAD> <FRAMESET border=0 frameSpacing=0 rows=82,* frameBorder=0 id="mainparent">
<FRAME name=topFrame src="${pageContext.request.contextPath }/system/elecMenuAction_title.do" noResize scrolling=no>
<FRAMESET id="main" border="0" frameSpacing="0" frameBorder="0" cols="153,1%,*">
<FRAME name="leftFrame" src="${pageContext.request.contextPath }/system/elecMenuAction_left.do" noResize>
<frame name="changeButton" src="${pageContext.request.contextPath }/system/elecMenuAction_change.do" frameBorder=0 marginHeight=0 marginWidth=0 scrolling=no noresize>
<FRAME name="mainFrame" src="${pageContext.request.contextPath }/system/elecMenuAction_loading.do" >
</FRAMESET>
</FRAMESET> </HTML>

创建elecMenuAction.java文件:

package com.itheima.elec.web.action;

@SuppressWarnings("serial")
@Controller("elecMenuAction")
@Scope(value="prototype")
public class ElecMenuAction extends BaseAction<MenuForm>{//需要一个Modeldriver MenuForm menuForm = this.getModel();
/**
* MenuHome系统登录的首页
* @return
*/
//执行保存
public String menuHome(){
System.out.println(menuForm.getName() + "--" + menuForm.getPassword());
return "menuHome";
} public String title(){
return "title";
}
public String left(){
return "left";
}
public String change(){
return "change";
}
public String loading(){
return "loading";
}
/**
* 重新登录
* @return 跳转到主页面index.jsp
*/
public String logout(){
//清空指定名称的session
// request.getSession().removeAttribute("arg0");
//清空所有session
request.getSession().invalidate();
return "logout";
}
}

对应struts.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- 开发模式 -->
<constant name="struts.devMode" value="true"></constant>
<!-- ui主题,简单主题 -->
<constant name="struts.ui.theme" value="simple"></constant>
<!-- 修改struts的后缀 改成do -->
<constant name="struts.action.extension" value="do"></constant> <!-- 系统管理 -->
<package name="system" namespace="/system" extends="struts-default">
<!-- 测试 -->
<action name="elecTextAction_*" class="elecTextAction" method="{1}">
<result name="save">/system/textAdd.jsp</result>
</action>
<action name="elecMenuAction_*" class="elecMenuAction" method="{1}">
<result name="menuHome">/WEB-INF/page/menu/home.jsp</result>
<result name="title">/WEB-INF/page/menu/title.jsp</result>
<result name="left">/WEB-INF/page/menu/left.jsp</result>
<result name="change">/WEB-INF/page/menu/change.jsp</result>
<result name="loading">/WEB-INF/page/menu/loading.jsp</result>
<result name="logout" type="redirect">
/index.jsp
</result>
</action>

</package>
</struts>

然后:登录后点击重新登录,退出首页

还有对应的loading.jsp页面

<%@ page language="java" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<link href="${pageContext.request.contextPath }/css/Style.css" type="text/css" rel="stylesheet" />
<style type="text/css">
<!--
body { margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body,td,th {
color: #000000;
}
-->
</style>
<style>
BODY {SCROLLBAR-FACE-COLOR: #cccccc; SCROLLBAR-HIGHLIGHT-COLOR: #ffffFF; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-3DLIGHT-COLOR: #cccccc; SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-TRACK-COLOR: #ffffFF; SCROLLBAR-DARKSHADOW-COLOR: #cccccc; }
</style>
<script language="javascript">
function shiftiframe(value)
{
if(value==1){
if(document.all.station.width==500)
{
document.all.station.width=1100;
document.getElementById("devtd").style.display="none";
}
else if(document.all.station.width==1100)
{
document.all.station.width=500;
document.getElementById("devtd").style.display="";
}
}
else{
if(document.all.dev.width==500)
{
document.all.dev.width=1100;
document.getElementById("stationtd").style.display="none";
}
else if(document.all.dev.width==1100)
{
document.all.dev.width=500;
document.getElementById("stationtd").style.display="";
}
}
}
/**添加10分钟后自动刷新页面,站点和设备运行的实时性*/
window.onload=function(){
setTimeout('refresh10()',1000*60*10) ;
}
function refresh10(){
window.location.reload();
}
</script>
<link href="${pageContext.request.contextPath }/css/login.css" rel="stylesheet" type="text/css">
</head> <body> <form name="Form1" method="post" action="name.aspx" id="Form1"> <table width="100%" border="0" height="88" border="1" background=${pageContext.request.contextPath }/images/back1.jpg>
<tr>
<td colspan=3 class="ta_01" align="center" background="${pageContext.request.contextPath }/images/b-info.gif"><strong>系统首页</strong></td>
</tr> <tr>
<td width="50%" height="84" align="left" valign="top" id="stationtd"> <fieldset id="stationset" style="width: 500px; height: 430px; padding: 1 background:${pageContext.request.contextPath }/images/back1.JPG"><legend>
<font color="#0000FF">
<img border="0" src="${pageContext.request.contextPath }/images/zoom.gif" width="14" height="14"><a href="#" onclick="shiftiframe('1')">站点运行情况</a></font></legend>
<IFRAME src="elecMenuAction_alermStation.do" name="station" id="station" frameBorder="0" width="500" scrolling="auto" height="400"></IFRAME> </fieldset> </td> <td width="50%" align="left" valign="top" id="devtd">
<fieldset id="devset" style="width: 500px; height: 430px; padding: 1 background:${pageContext.request.contextPath }/images/back1.JPG"><legend>
<font color="#0000FF">
<img border="0" src="${pageContext.request.contextPath }/images/zoom.gif" width="14" height="14"><a href="#" onclick="shiftiframe('2')">设备运行情况</a></font></legend>
<IFRAME src="elecMenuAction_alermDevice.do" name="dev" id="dev" frameBorder="0" width="500" scrolling="auto" height="400"></IFRAME>
</fieldset>
</td>
</tr>
<tr><td height=2></td></tr> </table> </form> </body> </html>

最新文章

  1. 奶牛健美操(codevs 3279)
  2. java8中hashMap
  3. Leetcode 118 Pascal&#39;s Triangle 数论递推
  4. Using NuGet without committing packages to source control(在没有把包包提交到代码管理器的情况下使用NuGet进行还原 )
  5. python中文json串创建与解析
  6. sql基本语法:
  7. android图片闪烁或帧动画
  8. jquery实现抽奖
  9. C#_事件委托
  10. 一个md5加密的工具类,用的虚拟机的包,不需要额外导包
  11. bug记录-setTimeout、setInterval之IOS7
  12. Oops信息及栈回溯
  13. IOS开发者证书申请及应用上线发布详解(2014版)
  14. 字典树 Trie树
  15. Java并发编程之synchronized
  16. VS2015 安装nuget离线包nupkg文件
  17. nginx stream 日志设置(Version 1.9.0 +)
  18. java框架之SpringCloud(5)-Hystrix服务熔断、降级与监控
  19. keycloak
  20. office online server部署和简单操作

热门文章

  1. easyui datagrid列拖拽
  2. hive执行流程分析
  3. thinkphp 3.2
  4. 关于Cocos2d-x中数据的存储
  5. (转)如何基于FFMPEG和SDL写一个少于1000行代码的视频播放器
  6. linux -- 服务开机自启动
  7. ini 文件操作记要(2): 使用 TMemIniFile
  8. Ubuntu 13.04 安装 Oracle11gR2
  9. 如何Request客户端的传值的Data
  10. 什么是代码?code?