0

I have a page where i have used framsets.

Top Frame = header information(Like logout, login user information etc) left Frame = Menu Items Center Frame = Data pages for the corresponding clicked menu

My problem is when i try to log out from the application The logout functionalist is called in header section and it also works find but the other frames are not closed.

How to over come this :

This the overall design with formsets

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ page contentType="text/html"%>
<%@ page pageEncoding="UTF-8"%>
<%
    String resourcePath = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="favicon.ico">
<title>SecureEyes - Infusing Security</title>
<script language="javascript" type="text/javascript" src="<%=resourcePath%>/scripts/frameset.js"></script>
<script language="javascript" type="text/javascript" src="<%=resourcePath%>/scripts/commonForHomePageTemplate.js"></script>
<script language="javascript">
<!--
var opt_no_frames = false;
var opt_integrated_mode = false;
var _help_prefix = "";
var _help_module = "";
var _context = "";
//-->
</script>
</head>

            <frameset border="0" frameborder="0" framespacing="0" rows="64,*">
                <form method="post" >

                    <frame border="0" frameborder="0" framespacing="0" id="topFrame" name="topFrame" src="<%=resourcePath%>/common/header.jsp" marginheight="0" marginwidth="0" noresize="noresize" scrolling="no">
                    <frameset border="0" frameborder="0" framespacing="0" id="MainFrameSet" cols="209,*">
                            <frame noresize="noresize" border="0" frameborder="0" framespacing="0" id="leftFrame" name="leftFrame" src="<%=resourcePath%>/common/left_menu.jsp" >
                            <frame border="0" frameborder="0" framespacing="0" id="workFrame" name="workFrame" src="<%=resourcePath%>/common/WelcomePage.jsp" marginheight="7" marginwidth="7" noresize="noresize" scrolling="auto">
                    </frameset>
                     <input type="hidden" id="method" name="method" />
                </form> 
            </frameset>
</html>

this is the place where i have logout functionalities :

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ page contentType="text/html"%>
<%@ page pageEncoding="UTF-8"%>
<%@page  import="com.secureyes.eswastha.struts.viewmodel.UserViewModel"%>
<%
    String resourcePath = request.getContextPath();
    UserViewModel userVM = new  UserViewModel();
    if(session.getAttribute("userDetails")!=null){
        userVM = (UserViewModel) session.getAttribute("userDetails");
    }
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="shortcut icon" href="https://indedev.com:8443/favicon.ico">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script language="javascript" type="text/javascript" src="<%=resourcePath%>/scripts/commonForHomePageTemplate.js"></script>
        <script language="javascript" type="text/javascript" src="<%=resourcePath%>/header_data/prototype.js"></script>
        <script language="javascript" type="text/javascript" src="<%=resourcePath%>/header_data/tooltip.js"></script>

        <link rel="stylesheet" type="text/css" href="<%=resourcePath%>/header_data/general.css">
        <link rel="stylesheet" type="text/css" href="<%=resourcePath%>/header_data/custom.css">
        <link rel="stylesheet" type="text/css" href="<%=resourcePath%>/header_data/layout.css">
        <link rel="stylesheet" type="text/nonsense" href="<%=resourcePath%>/header_data/misc.css">

<script>
    var tooltip;
    var opt_no_frames = false;
    var opt_integrated_mode = false;

        function logOut(){
        top.close();
        document.forms[0].action="LogoutAction.htm";
        document.forms[0].method.value="loginPage";
        document.forms[0].submit();
    }
</script>
<script>
    history.forward();
</script>

</head>
<body onload="SetContext(''); " onunload="" id="topCP">
<div class="body">
    <form method="post"> 
    <table cellspacing="0" width="100%">
        <tbody>
            <tr>
                <td class="companyLogo"><span class="topLogo"><img src="<%=resourcePath%>/header_data/logo.png" name="logo" border="0" height="53"></span></td>
                <td>
                    <div id="topTxtBlock" class="withTopRightLogo">
                        <span id="topTxtLoggedInAs">Logged in as <b><%=userVM.getUsername()%></b></span>
                        <span id="topTxtMyAccount"><a class="tootlipObserved" name="" id="" href="#" onmouseover='tooltip.set(event, [{"type":"string","string":"View preferences of your control panel account."}]);' onmouseout="tooltip.hide();" >My account</a></span>
                        <span id="topTxtLogout"><a class="tootlipObserved" href="#" onclick='if (confirm("Are you sure you want to log out?")) logOut("logout"); return false;' onmouseover='tooltip.set(event, [{"type":"string","string":"Log out of eSwastha."}]);' onmouseout="tooltip.hide();">Log out</a></span>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
        <input type="hidden" id="method" name="method" />
    </form>
</div>
<div style="position: absolute; top: 14px; left: 1111px; display: none;" class="tooltip">View preferences of your control panel account.<br></div>
</body>
</html>

When i press refresh than everything is loading again, so how to disable refresh and back and forward functionality using javascript ?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Java Questions
  • 7,813
  • 41
  • 118
  • 176

1 Answers1

1

Simple answer: Don't - use - frames

Community
  • 1
  • 1
Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
  • good explanation, but still the client wants to have the frames, what to do, if the client is for that than we as a developer have to – Java Questions Oct 23 '12 at 10:51
  • I won't go into the "a developer has to do what the client wants" discussion. As a developer I consider myself a professional, and if the client tells me how my work is best done - well, apparently he's more qualified, why hire me in the first place? I know, sometimes there are situations where you don't have much of a choice, but **frames** are just absurd. – Dennis Traub Oct 23 '12 at 10:55
  • :) good for discussion but not useful when the client is ... :) – Java Questions Oct 23 '12 at 10:59
  • "Doctor, I don't want to take that pill. There's this old technique, bloodletting or something. And they used to drink mercury, I want that too. I'm paying you, so you give me what I want. Oh, and I won't pay for you wasting your time washing your hands!" -- What do you think the doctor will do? – Dennis Traub Oct 23 '12 at 11:03
  • Nice to have spent time with you so for and it is getting interesting too :D – Java Questions Oct 23 '12 at 11:06