Link to home
Start Free TrialLog in
Avatar of prabudoss
prabudoss

asked on

jsp in frameset

We have the target page set as "Main.jsp" from the servlet and it is working fine to show the "Main.jsp" directly. Now we introduced <frameset> where in one frame I want this "Main.jsp" to be shown.
 
I tried setting target page as the "frameset" page and used the <frame src="Main.jsp"> but I'm getting some error like whatever values I used to get for display in Jsp (using the view bean imports) from "Main.jsp" are coming as null values now. Anything I'm missing here?
Avatar of rrz
rrz
Flag of United States of America image

><frame src="Main.jsp">
did you try like this
<frame name="top" src="Main.jsp"/>
Avatar of prabudoss
prabudoss

ASKER

Hi I tried that also. Not postive. I think I'm losing the pageContext there when src="Main.jsp" is executed. I tried

<html>
<head>
<title>a simple frameset document</title>
</head>
<FRAMESET rows="0%,100%">
      <FRAME name="first">
      <FRAME name="second"> <%pageContext.forward("Main.jsp");%>
</FRAMESET>
</html>


It opened the page correctly without error but now I don't know how to make this whole page inside the <Frame> because frame lies after the jsp page and targeting to the frame from my child Pop up fails.
>> values I used to get for display in Jsp (using the view bean imports)
where did you set this bean, if you set it in your servlet, then you must set it in session scope in order for your logic to work.

Why do you need a hidden frame in this way, I would suggest you to create the hidden frame first, then
src="yourservlet". servlet forward to main.jsp.
BTW, how about your pop windows session question. we are listening.
Yaah, you correct. In servlet, I'm setting  aRequest.setAttribute(view bean)
and in Jsp,
request.getAttribute (view bean)

How to make it session level? But the problem is we have a common jsp which will always be called from all the servlets and this common jsp will include the individual pages' jsp in it. If the view bean is made as session level, will that not be a problem for me?

>> How to make it session level?
in servlet:
aRequest.getSession().setAttribute(view bean)
in jsp:
session.getAttribute (view bean)

>> will that not be a problem for me?
it depend on your requirement. every user will have his own session. so different user won't affect each other.

why cannot you get the frame lay out first then call servlet?

<html>
<head>
<title>a simple frameset document</title>
</head>
<FRAMESET rows="0%,100%">
     <FRAME name="first">
     <FRAME name="second" src="path/to/servlet">
</FRAMESET>
</html>
Thanks for educating me. I will try the session level things first.

Basically my requirement is

I want a Modal dialog to submit to its parent which also is modal dialog. Always I have the target page set as the only "Main.jsp" from any servlet and all these dialog jsp will be included in it. As you know when you set target <form name =xxx target=...> as a modal dialog, the form always opens a new window instead of refreshing the same parent modal dialog. Hence I used <frameset> where in one frame where I want this "Main.jsp" to be shown so that I can give target name as this frame's name which my dialog pop up recognizes.

Let me know if you can see any better methods to achive this.
hmmm, how did you open up the model dialog window for Main.jsp? you should be able to give a name to your dialog windows and refer to it later in sub dialog.
I'm opening using showModalDialog(). even I did give self.name=xxx on body load of each dialog but when pop up from another Pop up, it simply could not refer to the target name and always opens the new window.
i c. so what url did you put into showModelDialog( url, ... )? url to your servlet?

have you tried to put the frame url in showModelDialog and let frame refer to you servlet, then server forward to jsp?
Yep. I'm giving the servlet url there. And exactly I'm using the same technique now. It is working as expected. But the thing is , my team have done with the coding and ready for testing. This will make them to code for one frame html for every dialog and call this frame instead of calling the servlet. I'm trying to reduce the rework and somehow want to use the common jsp which every servlet(including for the normal browser/dialog pages) target at (ie. Main.jsp) to hold this frame settings and that in turn make all the windows under it inside the frame. But somehow I could not do it :(

ASKER CERTIFIED SOLUTION
Avatar of kennethxu
kennethxu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks kennethxu. I will do the same (and if I face any more probs I will post again)
thanks for granting me points so quickly :) is there anything wrong in my comments lead to a 'B' grade?

tip#11 of http://www.cityofangels.com/Experts/Member_Tips.htm
Hi,
I'm new to this group and very bad in understanding this point system. I will regrade. Your are too good.
One more doubt. I added this in a javascript to forward to frameset url
<script>
...
var servletUrl= "/servlet/update?Page=CustomizeInformationCreateHandler";
var url="FrameContainer.jsp?servletUrl="+servletUrl;
window.showModalDialog(url,window,'edge:raised');
</script>

It opened the frameset page and went to that sevlet also and but simply could not recoginize the parameter if I use request.getAttribute(). How should I pass this parameter in servlet url to my framesetpage? Please help

     
try encoding that second "?"

encodeURIComponent(servletUrl)
try this:
var servletUrl= escape("/servlet/update?Page=CustomizeInformationCreateHandler");
var url="FrameContainer.jsp?servletUrl="+servletUrl;
Thanks a lot. It is working with escape!!!!
glad to know it's working. it's OK with you if I get grade fixed? let me know if you have further enquires.
Grade changed to an A as per the Author's request.

Thank you,

Wes Lennon
Director of Community Services
Experts Exchange
thanks prabudoss :-)