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. Linux进程同步机制

    为了能够有效的控制多个进程之间的沟通过程,保证沟通过程的有序和和谐,OS必须提供一定的同步机制保证进程之间不会自说自话而是有效的协同工作.比如在共享内存的通信方式中,两个或者多个进程都要对共享的内存进 ...

  2. ruby send respond_to

    http://ruby-metaprogramming.rubylearning.com/html/ruby_metaprogramming_2.html http://galeki.is-progr ...

  3. Jquery同时绑定多个事件

    //JQ 同时绑定多个事件 $("div.div_grren a img").bind({ mouseover:function(){ $(this).attr('src',bor ...

  4. 关于Struts2的jsp页面的注释

    语句就算用<!-- -->注释后,还是会在编译的时候显示在网页上,而且网页还会报错,因为注释的那些语句也会去编译,也会去检查有没有错误,所以一些注释掉的过时的变量和方法也会导致报错.500

  5. spring 优点

    spring 的优点?1.降低了组件之间的耦合性 ,实现了软件各层之间的解耦 2.可以使用容易提供的众多服务,如事务管理,消息服务等 3.容器提供单例模式支持 4.容器提供了AOP技术,利用它很容易实 ...

  6. implicit declaration of function 'copy_from_user'

    内核中使用copy_from_user()和copy_to_user()函数,编译出现错误: implicit declaration of function 'copy_from_user' 需要添 ...

  7. Configurations of Vim/GVim of dsp

    Linux环境写到用户主目录下的.vimrc文件(没有则新建),Windows环境则为GVim安装目录下的_vimrc(没有则新建),内容如下: "分上下两屏 "sp " ...

  8. par函数的new 参数-进行图片的叠加

    默认调用高级绘图函数的时候,会另外在绘制一副图,为了将两幅图绘制在同一张纸上,可以设置new = TRUE 代码示例: plot(1:5, c(2,3,2,3,2), col = "red& ...

  9. JQuery元素控制方法汇总

    1.在元素内部追加内容 $("元素名").append(content) 2.在元素中的不同位置追加内容 $("元素名").appendTo(content) ...

  10. 接口日志记录AOP实现-LogAspect

    使用spring aop日志记录 所需jar包 pom.xml <!-- logger begin --> <dependency> <groupId>org.sl ...