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>

SSH电力项目四-显示首页的更多相关文章

  1. SSH电力项目

    第一步:创建测试表Elec_Text: create table Elec_Text(textID varchar(50) not null primary key,textName varchar( ...

  2. SSH电力项目一 搭建Hibernate框架

    Hibernate所需要的基本文件: ElectText.java ElecText.hbm.xml hibernate.cfg.xml 第一步:创建测试表Elec_Text: create tabl ...

  3. SSH电力项目九--运行监控首页显示

    需求:在首页显示出设备运行情况,并去掉<br>换行符,每隔十分钟刷新一次页面. ElecMenuAction.java 首先注入运行监控service public class ElecM ...

  4. 电力项目十七--数据字典首页JS添加和删除表格

    知识点:jQuery是一个JavaScript函数库. JS代码: function insertRows(){ //获取表格对象 var tb1 = $("#dictTbl"); ...

  5. SSH电力项目三 - Dao层、service层查询实现(HQL)

    底层方法封装:模糊查询,姓张的人 查询思路:select * from elec_text o           #Dao层     where o.textName like '%张%'     ...

  6. SSH电力项目二

    底层方法封装(CommonDaoImpl类) public class CommonDaoImpl<T> extends HibernateDaoSupport implements IC ...

  7. SSH项目与SSM项目的进入首页的方法

    SSH项目中: jsp页面一般都是存放在WEB-INF下面的目录下,这样我们就不能直接访问到这些jsp页面了,保证了页面的安全性. 在struts的管理中,是利用action来实现页面的跳转,进入in ...

  8. 在xcode运行编译时,编译成功,但项目中显示缺少该文件,这是只要关闭重启xcode即可。

    在xcode运行编译时,编译成功,但项目中显示缺少该文件,这是只要关闭重启xcode即可.

  9. SSH框架项目开发命名规范

    SSH 框架项目开发命名规范   一.各层包及类命名规范   总体原则:包名所有字母小写,类名采用 "驼峰标识",具体如下:   1. Action 类      包命名规范:co ...

随机推荐

  1. 关于win7下安卓开发环境的搭建

    一.下载安装JDK(不用配置环境变量) 1.先卸载原来存在的JDK 控制面板-卸载程序-有两个软件(Java SE Development Kit 8 Update 101(64-bit)和Java ...

  2. BaaS后端即服务 - 概念篇

    摘要: 什么是BaaS? BaaS(Backend as a Service)是一种新型的云服务,旨在为移动和Web应用提供后端云服务,包括云端数据/文件存储.账户管理.消息推送.社交媒体整合等.Ba ...

  3. 单例模式/ java实现附代码 /

    注: 场景和例子出自github的设计模式.传送门:https://github.com/iluwatar/java-design-patterns/tree/master/singleton 意图: ...

  4. CentOS后台运行和关闭、查看后台任务命令

    fg.bg.jobs.&.nohup.ctrl+z.ctrl+c 命令 一.& 加在一个命令的最后,可以把这个命令放到后台执行,如 watch -n 10 sh test.sh &am ...

  5. 【Java面试题】35 List, Set, Map是否继承自Collection接口?

    Collection是最基本的集合接口,声明了适用于JAVA集合(只包括Set和List)的通用方法. Set 和List 都继承了Conllection:Set具有与Collection完全一样的接 ...

  6. jQuery-处理class属性

    1.addClass方法 为每个匹配的元素添加指定的样式类名 参数类型说明: 1)class名称(字符串) 每个匹配元素添加的一个或多个用空格隔开的样式名 2)function(index, curr ...

  7. BDIP和BVLC纹理分析

    Young Deok Chun 等人提出了基于 BVLC 矩和 BDIP 矩的一种纹理分析方法.BVLC 能显示粗糙和光滑特性,BDIP 能够很好的提取波谷和边缘.它们直接在彩色空间上进行处理,能有效 ...

  8. android 开发者资源下载地址记录(转+补充)

    https如果无法下载的话将下面的:https://dl-ssl 部分改为 http://dl (1)Android SDK (Android SDK主安装包,包含SDK Manager.AVD Ma ...

  9. System.Func<>与System.Action<>

    使用并行编程可以同时操作多个委托,在介绍并行编程前先简单介绍一下两个泛型委托System.Func<>与System.Action<>. Func<>是一个能接受多 ...

  10. Android中的渐变

    LinearGradient的用法 LinearGradient linearGradient; linearGradient = new LinearGradient(0, 0, 0, getHei ...