Hi,
I received many mails asking me for examples of using JSP's in frames.
Since i can't reply individually to each of them i am posting some example code
which works for me. Feel free to look at them and if any mistakes are made (by
me) correct me. Thank you.
Cheers,
Amar..
MAIN.JSP
------------------
<%@ page session="false" %>
<jsp:include page="/jsp/Database.jsp" />
<html>
<head>
<title> Main Page</title>
</head>
<frameset framespacing="0" border="0" rows="57,*" frameborder="0">
<frame name="banner" scrolling="no" noresize target="contents" src="top.htm">
<frameset cols="164,*">
<frame name="contents" target="main" src="menu.jsp" scrolling="auto">
<frame name="main" target="_top" src="welcome.jsp" scrolling="auto">
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>
MENU.JSP
-----------------
<%@ page session="false" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Menu</title>
<base target="main">
</head>
<body>
<table border="0">
<tr>
<td width="100%"><a href="page1.jsp"><img border="0" src="elect.gif"
width="108" height="25"></a></td>
</tr>
<tr>
<td width="100%"><a href="page2.jsp"><img border="0" src="w_work.gif"
width="108" height="25"></a></td>
</tr>
<tr>
<td width="100%"><a href="page3.jsp"><img border="0" src="single.gif"
width="108" height="40"></a></td>
</tr>
<tr>
<td width="100%"><a href="page4.jsp"><img border="0" src="work.gif"
width="108" height="25"></a></td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td width="100%"><a href="AddUser.jsp"><img border="0" src="add.gif"
width="108" height="25"></a></td>
</tr>
<tr>
<td width="100%"><a href="ChangePassword.jsp"><img border="0"
src="pass2.gif" width="108" height="25"></a></td>
</tr>
<tr>
<td width="100%"><a href="LogOut.jsp"><img border="0" src="logout.gif"
width="108" height="25"></a></td>
</tr>
</table>
</body>
</html>
WELCOME.JSP
-------------------------
<%@ page import="xyz.beans.SessionObject" session="false" %>
<%! HttpSession session=null; %>
<%! String name = null ; %>
<%! String userType = null ; %>
<%
session = request.getSession(false);
%>
<% if(session == null) { %>
<jsp:forward page="error.jsp" /> // redirect user to the Error page
<% } else {
SessionObject tech = (SessionObject)session.getValue("TECH");
name = tech.getName() ;
userType = tech.getUserType() ;
session.putValue("TECH",tech);
}
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Welcome Page</title>
</head>
<body>
<table border="0">
<tr>
<td valign="top">
<table border="0" width="100%">
<tr>
<td width="40"><img border="0" src="name.gif" width="108"
height="22"></td>
<td width="60%"> <%= name %></td>
</tr>
<tr>
<td width="40"><img border="0" src="logas.gif" width="108"
height="22"></td>
<td width="60%">
<%= userType %>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html