• Post Reply Bookmark Topic Watch Topic
  • New Topic

Losing request when using frames

 
Ezra Exposito
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have a login page for my users and they
get sent to a page that has frames.
Frames.jsp contains
frame1 - Navigation.jsp
frame2 - Welcome.jsp
When they log into the system I am dynamically loading a navigation menu into the request which I want to display in Navigation.jsp but the request is being sent to Frames.jsp so when
Navigation.jsp loads it is empty. Any help would
be greatly appreciated ... Thanks.
 
Stella Liang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new to java too, you can try using Navigation.jsp?var1=****&&var2=*** or use JavaBean to share the information.
Another method is not to use frame but to use jsp:include.
If I am wrong, please let me know. Thank you.
Originally posted by Ezra Exposito:
Hello, I have a login page for my users and they
get sent to a page that has frames.
Frames.jsp contains
frame1 - Navigation.jsp
frame2 - Welcome.jsp
When they log into the system I am dynamically loading a navigation menu into the request which I want to display in Navigation.jsp but the request is being sent to Frames.jsp so when
Navigation.jsp loads it is empty. Any help would
be greatly appreciated ... Thanks.

[ June 30, 2002: Message edited by: Stella Liang ]
 
George Joseph
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ezra,
From what I understand from your posting is that you are submitting a request to Frame.jsp. And you want navigation.jsp also to get all the request parameter.
The simplest way is you have to recreate the url for navigation.jsp inside frame.jsp
Suppose 2 'form field - textbox' values, say username and passwd are submited to frame.jsp, during login process, and you want the values to be available in navigation.jsp also, then the required code will be.

--------- Frame.jsp --------
<%@page language="java"%>
<%
// Process the frame.jsp logic first
// Build the required leftframe url dynamically like.
String leftpage="navigation.jsp?username=" + request.getParameter("username") + "&password=" + request.getParameter("passwd");
String rightpage="Welcome.jsp";
%>
<frameset framespacing="0" border="0" rows="200,*" frameborder="0">
<frame name="left" src="<%=leftpage%>">
<frame name="right" src="<%=rightpage%>">
</frameset>
-------- Frame.jsp --------


George Joseph
Transversal E Networks
[ June 30, 2002: Message edited by: George Joseph ]
 
Ezra Exposito
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is exactly what I had in mind;however,
I have an entire navigation bean I want to send
to navigation.jsp and that would be too much data
to store in the url.
Thanks
Originally posted by George Joseph:
Hi Ezra,
From what I understand from your posting is that you are submitting a request to Frame.jsp. And you want navigation.jsp also to get all the request parameter.
The simplest way is you have to recreate the url for navigation.jsp inside frame.jsp
Suppose 2 'form field - textbox' values, say username and passwd are submited to frame.jsp, during login process, and you want the values to be available in navigation.jsp also, then the required code will be.

--------- Frame.jsp --------
<%@page language="java"%>
<%
// Process the frame.jsp logic first
// Build the required leftframe url dynamically like.
String leftpage="navigation.jsp?username=" + request.getParameter("username") + "&password=" + request.getParameter("passwd");
String rightpage="Welcome.jsp";
%>
<frameset framespacing="0" border="0" rows="200,*" frameborder="0">
<frame name="left" src="<%=leftpage%>">
<frame name="right" src="<%=rightpage%>">
</frameset>
-------- Frame.jsp --------


George Joseph
Transversal E Networks
[ June 30, 2002: Message edited by: George Joseph ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll add this to my list of reasons why frames suck.
Seriously, much much better to design without them.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi george,
there is a problem in what you suggested to do.
the problem is that when we view the source of the page having these frames then the user will see the login/password in simple text form in the url we encoded for nevigation.jsp. i am not sure if this can cause any problems but i guess it's better if we don't show the password in text format anywhere!
there seems another way. one can put the bean in the Session object and remove it from the session object in nevigation.jsp if we don't want to have bulky session object. but if Session object works through Cookies only and the browser has disabled the cookies then this will be a real problem. we can't make this happen and i will agree with David.
regards
maulin.
 
George Joseph
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Maulin,
You are absolutely correct in case of vital data, URL Rewriting is not a good solution.
In such cases you can use beans with session scope. That is in frame.jsp you must set all values to the bean. And then access the values in Navigation.jsp
In such cases the code for frame.jsp will be like
---------- frame.jsp -----------
<%@page language="java"%>
<jsp:useBean id="navigate" class="Navigation" scope="session" />
<%
// Process the frame.jsp logic
navigate.setUser(request.getParameter("username"));
navigate.setPassword(request.getParameter("passwd"));
navigate.set.....
%>
<frameset framespacing="0" border="0" rows="200,*" frameborder="0">
<frame name="left" src="Navigation.jsp">
<frame name="right" src="Welcome.jsp">
</frameset>
-------- frame.jsp --------
The code for Navigation.jsp will be like
-------- Navigation.jsp --------
<%@page language="java"%>
<jsp:useBean id="navigate" class="Navigation" scope="session" />
<%
String username = navigate.getUser();
String passwd = navigate.getPassword();
String abc = navigate.get.....
// Process the navigation logic
............
%>
---------- Navigation.jsp -----------

George Joseph,
Transversal E Networks.
 
Ezra Exposito
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your input, you have been a great help.
Ezra
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!