?
Solved

jsp in frameset

Posted on 2003-03-07
21
Medium Priority
?
829 Views
Last Modified: 2013-11-19
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?
0
Comment
Question by:prabudoss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 8
  • 2
  • +1
21 Comments
 
LVL 28

Expert Comment

by:rrz
ID: 8088970
><frame src="Main.jsp">
did you try like this
<frame name="top" src="Main.jsp"/>
0
 

Author Comment

by:prabudoss
ID: 8089275
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.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8089885
>> 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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:kennethxu
ID: 8089898
BTW, how about your pop windows session question. we are listening.
0
 

Author Comment

by:prabudoss
ID: 8090043
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?

0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8090136
>> 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>
0
 

Author Comment

by:prabudoss
ID: 8090344
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.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8090830
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.
0
 

Author Comment

by:prabudoss
ID: 8090907
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.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8091012
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?
0
 

Author Comment

by:prabudoss
ID: 8091174
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 :(

0
 
LVL 14

Accepted Solution

by:
kennethxu earned 200 total points
ID: 8091228
>> This will make them to code for one frame html for every dialog.

you don't have to, change frame html to jsp (or servlet), then one is enough:
<html>
<head>
<title>a simple frameset document</title>
</head>
<FRAMESET rows="0%,100%">
    <FRAME name="first">
    <FRAME name="second" src='<%=request.getParameter("targetServlet")%>'>
</FRAMESET>
</html>

>> and call this frame instead of calling the servlet.
you can remap the frame to that url, so you even don't have to change the caller, say if originally mapped your servlet to "/MyServlet", now you map the above jsp to "/MyServlet" in web.xml, than map your origial servlet to "/MyRealServlet", in frame jsp, src="/MyRealServlet"

0
 

Author Comment

by:prabudoss
ID: 8091343
Thanks kennethxu. I will do the same (and if I face any more probs I will post again)
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8091428
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
0
 

Author Comment

by:prabudoss
ID: 8094207
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

     
0
 
LVL 28

Expert Comment

by:rrz
ID: 8094440
try encoding that second "?"

encodeURIComponent(servletUrl)
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8094686
try this:
var servletUrl= escape("/servlet/update?Page=CustomizeInformationCreateHandler");
var url="FrameContainer.jsp?servletUrl="+servletUrl;
0
 

Author Comment

by:prabudoss
ID: 8097766
Thanks a lot. It is working with escape!!!!
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8108542
glad to know it's working. it's OK with you if I get grade fixed? let me know if you have further enquires.
0
 

Expert Comment

by:WesLennon
ID: 8113876
Grade changed to an A as per the Author's request.

Thank you,

Wes Lennon
Director of Community Services
Experts Exchange
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8114031
thanks prabudoss :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question