This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes Frame synchronization forJSP's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Frame synchronization forJSP Watch "Frame synchronization forJSP New topic
Author

Frame synchronization forJSP's

Mahesh Eshwarappa
Greenhorn

Joined: Jan 04, 2001
Posts: 28
Hi,
In my web application I had 3 frames which loaded 3 JSP's in 3 frames. Am using Weblogic server.
I was getting an exception called concurrent modification exception.
I serialized the frames by using body onLoad event in JavaScript at the client end, so that each page in turn calls the other page.
It worked .
Is there any way to serialize the Jsp's so that one Jsp at a time is sent from the server .
Mahesh
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
Web servers and servlet engines just respond to requests. Controlling the order of the requests requires something on the browser side.
Bill
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
It worries me a little that you are getting this sort of error. It implies that you have written your JSPs in a way which requires a certain sequence of activation, as each is performing part of a sequence of modification operations. This is very dangerous. It's vety easy to trip yourself up with assumptions like this - different browsers have very different approaches to requesting pages and frames, and users are free to "reload" or "refresh" at any time.
A better model for your system might be to have the JSPs as purely views on some data stored in the session (in beans or regular objects), with any data modifications done before any of the JSPs are invoked. Each time each JSP is called, it simply reports on the current state of the data without modifying it at all.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Joe Paolangeli
Ranch Hand

Joined: Apr 05, 2000
Posts: 73
I think you are complicating the task with this javascript and serialization stuff. You do not need anything fancy to load a JSP into a frame. Here is some sample html code:

Good Luck,
Joe
Mahesh Eshwarappa
Greenhorn

Joined: Jan 04, 2001
Posts: 28
Hi Joe,
I was loading the JSPs in a similar code which u have mentioned. But I got an exception which said "COncurrent Modification exception" . when 2 frames loaded at a time.
I then tried loading one frame at a time and serialized It worked. But I feel there should be some way at the server end in which u can serialize the Jsp's. I have wasted a good amount of time on how to do this.
All the inputs from u guys is precious to me.
Regards
Mahesh
Originally posted by Joe Paolangeli:
[B]I think you are complicating the task with this javascript and serialization stuff. You do not need anything fancy to load a JSP into a frame. Here is some sample html code:

Good Luck,
Joe[/B]

Joe Paolangeli
Ranch Hand

Joined: Apr 05, 2000
Posts: 73
Can you post some of the code (frames and JSPs) that you used before using the javascript and serialization?
Also what web server are you using?

Thank you,
Joe
Mahesh Eshwarappa
Greenhorn

Joined: Jan 04, 2001
Posts: 28
Hey Joe,
At present we r using Weblogic itself as the Webserver.
Each Jsp page is calling a bean class
which in turn calls the database tables for the presentation of the data. And each data set is being fetched depending on who the user is?
This is my frame source HTML
*************************************************************
<html>
<head>
</head>
<frameset rows="43,*,20" border="0">
<frame name="toolbar" src="/html/toolbar.htm" border="0" scrolling=no>
<frameset cols="20%,*" border="0">
<frame name="tree" target="fracontent" src="/html/blank.htm" STYLE="border-right: solid #6699cc 8px; border-top: solid #003366 1px;" SCROLLING="auto" TOPMARGIN="0" LEFTMARGIN="3pt" MARGINHEIGHT="0" MARGINWIDTH="0" FRAMEBORDER="0" BORDER="0" >

<frame name="fraContent" target="" src="/html/tab.htm" STYLE="border-left: groove #99ccff 2px; border-top: solid #003366 1px;" FRAMEBORDER="no" BORDER="0" BORDERCOLOR="#6699CC" scrolling=no >
</frameset>

<frame name="footnotes" src="/html/blank.htm" border="0" scrolling=no >
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>
***********************************************************
The Tab.htm internally has a floating frame which loads the first Jsp in the fraContent main frame at the center.
The first jsp in turn loads the second Jsp as a footer in footnotes frame
The second Jsp in turn loads the 3rd Jsp on the left hand side Its basically a tree structure for a user.

The main page looks like this
*********************************************************
Top frame Htm
********************************************************
* *
*
* TREE *
* JSP *
* * Main JSP
* *
* *
* *
* *
************************************************************
* Footer JSP
*
*****************************************************************
Regards
Mahesh
Joe Paolangeli
Ranch Hand

Joined: Apr 05, 2000
Posts: 73
Very interesting...
I would like to suggest a different approach using a Model View Controller (MVC) pattern. I am sure you can find many MVC posts on this site.
Here is a sample design for your problem:
1.) You probably have an html page that links to your frame page. I would change this page to call a controller servlet.
2.) The controller servlet would do the following:
- Retrieve all of the data required to be displayed in the frames (you are currently doing this in your JSPs).
- Store the data in some java beans (you need to define these).
- Store the java beans in the HTTPSession Object
- Use RequestDispatcher to forward the request to your frame JSP page (you need to change your frame html page to a frame JSP page).
3.) Your frame JSP page should be set up to reference JSP pages similiar to the format in my first post. This only applies to the html pages that require data.
4.) In your JSP pages you would display the java bean data that was created in the controller servlet.
I think using an MVC approach will give you much better results and a flexible solution.
I hope this helps,
Joe

Mahesh Eshwarappa
Greenhorn

Joined: Jan 04, 2001
Posts: 28

Thanx Joe for u r opinion.
Regards
Mahesh
 
GeeCON Prague 2014
 
subject: Frame synchronization forJSP's