473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Web architecture with javascript

I am faced with the task of porting a client application to a web
architecture platform, e.g. to make it browser based. The technology I
used was J2EE, e.g. servlets/JSP pages and HTML/javascript.

The application I'm talking about is displaying data from database in
grids, roughly speaking from 3 tables, that have parent-child
relationship between them, and when you click on a row in a parent
grid the content in the child grid should change.

I decided for two design patterns, that I'm now beginning to doubt,
which is the reason I'm posting this.

In order to make the design similar I created a javascript component,
Table using the rather awkard javascript notation for object oriented
programming. The usage of that table is similar to the table in Swing
or SWT:

Table a = new Table()
TableColumn b = new TableColumn(a,"Column1);
b.setWidth(100);
....
TableItem c = new TableItem(a)
c.setText(["Text for column1","Text for column2"]);

The other design pattern was to use IFRAMEs extensively in order to
make the visual appearance similar to the existing client application,
e.g. that the whole page doesn't refresh, when you do a new query.
The main problem I'm having is that when the result set of a query
that is intended to be displayed in the grids is large, the browser
takes a lot of time just interpreting the javascript.

The general problem with using IFrames is that in order to achieve
correct synchronization between frames you have to resort to cross
frame scripting and unusual method of synchronization because the
programmatic submittal of form is an asynchronous operation.

So now I think I must rethink my design to move more tasks to the
server, and simplify the framing. I wanted to know if someone has
experienced something similar, and could provide some hints.

Regards, Halldor
Jul 20 '05 #1
2 1786
Halldor Isak Gylfason wrote:
I am faced with the task of porting a client application to a web
architecture platform, e.g. to make it browser based. The technology I
used was J2EE, e.g. servlets/JSP pages and HTML/javascript.

The application I'm talking about is displaying data from database in
grids, roughly speaking from 3 tables, that have parent-child
relationship between them, and when you click on a row in a parent
grid the content in the child grid should change.

I decided for two design patterns, that I'm now beginning to doubt,
which is the reason I'm posting this.

In order to make the design similar I created a javascript component,
Table using the rather awkard javascript notation for object oriented
programming. The usage of that table is similar to the table in Swing
or SWT:

Table a = new Table()
TableColumn b = new TableColumn(a,"Column1);
b.setWidth(100);
...
TableItem c = new TableItem(a)
c.setText(["Text for column1","Text for column2"]);

The other design pattern was to use IFRAMEs extensively in order to
make the visual appearance similar to the existing client application,
e.g. that the whole page doesn't refresh, when you do a new query.
The main problem I'm having is that when the result set of a query
that is intended to be displayed in the grids is large, the browser
takes a lot of time just interpreting the javascript.

The general problem with using IFrames is that in order to achieve
correct synchronization between frames you have to resort to cross
frame scripting and unusual method of synchronization because the
programmatic submittal of form is an asynchronous operation.

So now I think I must rethink my design to move more tasks to the
server, and simplify the framing. I wanted to know if someone has
experienced something similar, and could provide some hints.

Regards, Halldor


Hi Halldor,

Javascript is indeed very slow when you need a lot of IFrames communicating
and you have many fields with names (you table-grid is not 4 by 5 I
guess...)
I once faced a similar problem, very similar actually, which was extremely
slow too.
I think my case was easier because I didn't need to add new rows and such
without refreshing, which makes thing easier.
I had a x by y grid that didn't change its size during interaction with the
user. But maybe this helps you going anyway:

The solution I implemented was just a one-page HTML + 1 hidden frame, no
Inner Frames, with named textfields (like col3row8) in a table.
When textfields were changed by the user, I had to recalculate some stuff
and update other fields (just summing and averages, done by Javascript).

When certain other elements were changed, I had to update a dropdownmenu eg,
and needed new information from the database..
This can be accomplished by using a hidden frame, where you can post your
changes and/or query your server, which in turn responds with the new data.
You have to make the response from the server in such a way that it will
call some javascrip-routine when loaded. This javascript must then update a
dropdown or something by adding and removing elements.

It is not easy and you can expect certain troubles when the user is very
active or the server slow with responses. So I blocked userinteraction with
the fields during these kind of updates, otherwise I would still have a
headage. :-)

I hope this helps you a bit.
Good luck!
Regards,
Erwin Moller
Jul 20 '05 #2
Halldor Isak Gylfason wrote:
I am faced with the task of porting a client application to a web
architecture platform, e.g. to make it browser based. The technology I
used was J2EE, e.g. servlets/JSP pages and HTML/javascript.
I'm using Tapestry, which is an extremely powerfull framework for creating
& running web-apps. It uses any standard web-app server on the frontside
and java and all that comes with it on the backend. Absolutely superior to
servlets/JSP.
The application I'm talking about is displaying data from database in
grids, roughly speaking from 3 tables, that have parent-child
relationship between them, and when you click on a row in a parent
grid the content in the child grid should change.
I'm doing something similar with a TreeTable, the size of which can be 5k+
rows or more (or less, but i'll come to that later).
It is also fed by a db.
Obviously i'm also dealing with parent-child relationships (going down to a
beforehand unknown level).
I decided for two design patterns, that I'm now beginning to doubt,
which is the reason I'm posting this.

In order to make the design similar I created a javascript component,
Table using the rather awkard javascript notation for object oriented
programming. The usage of that table is similar to the table in Swing
or SWT:

Table a = new Table()
TableColumn b = new TableColumn(a,"Column1);
b.setWidth(100);
....
TableItem c = new TableItem(a)
c.setText(["Text for column1","Text for column2"]);

The other design pattern was to use IFRAMEs extensively in order to
make the visual appearance similar to the existing client application,
e.g. that the whole page doesn't refresh, when you do a new query.
I decided to use as much 'standard' HTML as possible.
So the table is known and all the data is encapsulated by numerous tbodies.
Allowing me to handle distinct 'sub sets' independently of the rest.
The main problem I'm having is that when the result set of a query
that is intended to be displayed in the grids is large, the browser
takes a lot of time just interpreting the javascript.
What i am doing is filling a js array (hashtable like structure) on the
server with the html required for the different rows.
Those entries are written to the screen using the document.write()
function. The array is stored in a hidden frame (which acts as a function
library as well as data-repository surviving page-sessions).
One only goes to the server for updating (not sending anything back except
errors). Otherwise one just stays client side (also for state)
The general problem with using IFrames is that in order to achieve
correct synchronization between frames you have to resort to cross
frame scripting and unusual method of synchronization because the
programmatic submittal of form is an asynchronous operation.
When someting changes (or a branch get loaded dynamically) I just produce
the proper code on the server (remember the js array), replace the old
tbody entry with the new entry in the hashtable and write the structure out
to the screen again (respecting the old state).

One of the issues I had was the fact that the elements of a document in a
window loose their meaning once the doc is gone. You cannot rely on making
references to any element after the document is gone.

I noted that Erwin uses a hidden frame for server comm and update the
viewable document from there. Sounds fine to me as well. I guess it all
depends on the complexity and size of the structure and the parts to be
updated. I produce all my HTML via Java on the server and just write out a
string on the client. I'm not using any createElement(xyz) js function at all.
So now I think I must rethink my design to move more tasks to the
server, and simplify the framing. I wanted to know if someone has
experienced something similar, and could provide some hints.


One small thing though, i am using Gecko to debug my js. MS however tends
to crap out quite often of stuff which is supposed to be standard. So,
unless you don't care about that just keep it in the back of your mind
(would have saved me a *lot* of rewriting)

Goog luck,
Fermin DCG
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Abdullah Kauchali | last post by:
Hi folks, (Need comments if you have done something like this before. Any response would be greatly appreciated.) We've recently been prototyping the idea of completely avoiding the server...
2
by: Roger Irwin | last post by:
I have been browsing through the Mozzilla source and have been impressed at the level to which javascript decends. Clearly there is a lot of javascript that ends up embedded in the binaries and not...
25
by: David Noble | last post by:
We've been developing a web site using 3-tier architecture for 18 months now. There is a common layer that defines the classes - using XML schemas. The data layer acts as a wrapper to 3 databases...
6
by: Michael Rodriguez | last post by:
If you're using a standard 3-tiered architecture, i.e. Data Layer-> Business Layer->Presentation Layer, where is the recommended place to put data validations? Specifically, data validations such...
2
by: Wee Bubba | last post by:
i started by designing my web page using frames. i had my data entry form in an upper form and my data rows displaying in a lower frame. i soon discovered that ASP.NET is not really meant for...
8
by: CaptainDeep | last post by:
Hi all, I have couple of questions about architecting web application using asp.net 1. is ther any performance gain in using c# over vb.net 2. best way to handle transactions in .net? using ado...
6
by: carsonbj | last post by:
I have an issue where the below operation works on a little-endian architecture but not on a big-endian architecture. I was under the impression that pointer arithmetic is architecture independant...
13
by: rrs.matrix | last post by:
hi i have to detect the type of CPU. whether it is 32-bit or 64-bit.. how can this be done.. can anyone please help me.. thanks.
0
by: rsdev | last post by:
Hi, I am new to ASP.NET and I am trying to build a CMS application using theBeerHouse SK. I am adapting the Datareader to collect information from an SQL database and send it to an HtmlHeader. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.