Hi
I was browsing through the archives and found your example with frames very
helpful.
I am following the Servlet -> JSP architechture. So, all the requests come
to my servlet, the servlet makes computation and sends results to the JSP
in a bean.
For the login command, I need to display the user's home page with frames,
if login was successful. The LoginServlet authenticates the user and gets
the data needed for home page and passes it over to MAIN.JSP, which uses
three frames. MAIN.JSP does not itself use the bean, but one of its frames
(HOME.JSP) uses it.
LoginServlet.java
-----------------
ResultBean rb = new ResultBean();
rb.setXXX(..);
rb.setYYY(..);
req.setAttribute("resultBean", rb);
getServletContext().getRequestDispatcher("/jsp/main.jsp").forward(req, rep);
MAIN.JSP
--------
<frameset rows="79,*,20" scrolling="no" ....
<frame src="/jsp/home.jsp" name="main" ...
HOME.JSP
--------
<jsp:useBean
id="resultBean"
scope="session"
class="com.vitaltone.servlet.ResultBean"
/>
<b>Result : </b>
<jsp:getProperty
name="resultBean"
property="result"
/>
To my surprise, resultBean instance was null in HOME.JSP. What might be the
problem?
Thanks for any help.
--
shiv
[EMAIL PROTECTED]
On Fri, 19 Nov 1999 13:14:48 -0500, Nanduri Amarnath <[EMAIL PROTECTED]>
wrote:
>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>
===========================================================================
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