problem in AJAX

G

gk

AJAX sends XML response. and javascript function parses that XML
response and then HTML DOM is updated.


I AM in a confused state whether i should use AJAX or NOT...



Because i dont want javascript function to pase the XML . i want to
use my java XML parser and want to parse in the server side. and want
to store the data in a java bean and then i want to display the data
from the java bean.

The reason i want to avoid JS XML parsing is

1) my XML is huge.
2) it would become messy in the client side.
3) i want to use server side XML parsing and want to diaply the data in
my JSP via java bean.


is it possible to use AJAX now ? How ? AJAX wont allow to use java bean
and server side parsing . it would try to parse by its own.
 
R

Roedy Green

is it possible to use AJAX now ? How ? AJAX wont allow to use java bean
and server side parsing . it would try to parse by its own.

Ajax is sort of like an el-cheapo generic Applet that can to a very
limited subset of the things Java can do. Its big advantage is it
smaller and loads faster than the Java JVM. If you have your Applet
talk to the server instead, Ajax is no longer involved.

For a large volume of data, XML is a pretty fluffy way to transport
it.
Consider a DataOutputStream or a GZIPed ObjectStream.

see http://mindprod.com/applets/fileio.html
for sample code to send the data over a socket.
 
T

TechBookReport

gk said:
AJAX sends XML response. and javascript function parses that XML
response and then HTML DOM is updated.


I AM in a confused state whether i should use AJAX or NOT...



Because i dont want javascript function to pase the XML . i want to
use my java XML parser and want to parse in the server side. and want
to store the data in a java bean and then i want to display the data
from the java bean.

The reason i want to avoid JS XML parsing is

1) my XML is huge.
2) it would become messy in the client side.
3) i want to use server side XML parsing and want to diaply the data in
my JSP via java bean.


is it possible to use AJAX now ? How ? AJAX wont allow to use java bean
and server side parsing . it would try to parse by its own.
You might want to take a look at this:
https://blueprints.dev.java.net/ajax-faq.html
 
G

gk

Roedy said:
Ajax is sort of like an el-cheapo generic Applet that can to a very
limited subset of the things Java can do. Its big advantage is it
smaller and loads faster than the Java JVM. If you have your Applet
talk to the server instead, Ajax is no longer involved.

For a large volume of data, XML is a pretty fluffy way to transport
it.
Consider a DataOutputStream or a GZIPed ObjectStream.

see http://mindprod.com/applets/fileio.html
for sample code to send the data over a socket.


do u suggest me to use AJAX and update HTML dom via javascript ?


but i was interested about XML parsing and java bean and JSTL tags to
display the data . and AJAX is not letting me to do that.


i am scared to go for HML DOM updation by AJAX because my JSP page is
complex , with CSS,flash etc etc.
 
R

Roedy Green

do u suggest me to use AJAX and update HTML dom via javascript ?
That would do fine for low volumes and where the processing is not
that complicated. My understanding is that Ajax is not a programming
language, but more a forms defining language that its not nearly so
lame as HTML forms.

The problem with using AJax or similar light weight solutions is if
the program gets more and more complicated, it gets harder and harder
to kludge it together one more time. Eventually you have to start
over from scratch.

The main problem with using Applets is your users will be annoyed at
the start up times to do a very simple thing. They won't like be
hassled with computer geeky stuff like Applet privilege granting.
 
R

Roedy Green

i am scared to go for HML DOM updation by AJAX because my JSP page is
complex , with CSS,flash etc etc.

My tendency is to try to reduce the number of tools in any given
project to a minimum. Why?

1. if someone has to take this project over, it will be a lot easier
to find someone who knows one or two tools, rather than a random set
of 9.

2. The tools were designed by people who have never met. It is a
bloody miracle when they work together as promised.

3. A chain is as strong as its weakest link. If any one of those tools
loses support, I may have do massive amounts of changes to redesign
without it. Probability theory tells you that your danger increases
with the number of tools in the exponent.

4. There will be less duplication. More RAM will be left over to do
something useful. Do I really need 8 different calendar calculators?

5. It is less confusing.

6. I once worked for a guy who was the very opposite. He was a tool
junkie and he liked to use as many as possible simply for the fun of
learning to use them and selecting the perfect tool for each
individual task. The problem was he was the only one who really had
the big picture of what was going on, since everyone who worked for
him specialised is some subset of them. People would be helpless when
they were forced to wander out of their skillset in an "emergency". He
was convinced everyone else SHOULD have the same level of skill as he
did in everything. Of course the reality was they never did and had
to waste time learning a whole tool just to understand a few lines.
 
S

Steve Sobol

gk said:
is it possible to use AJAX now ? How ? AJAX wont allow to use java bean
and server side parsing . it would try to parse by its own.

AJAX's primary purpose is to enable you to go fetch XML from a URL. That URL
can be a server-side script; TCL, JSP, Python, PHP, Perl, shell script,
anything :D

What exactly do you need to do?
 
S

Steve Sobol

gk wrote:

but i was interested about XML parsing and java bean and JSTL tags to
display the data . and AJAX is not letting me to do that.

JSP/JSTL is server-side. AJAX is, by definition, client-side.
 
C

Chris Smith

Roedy said:
That would do fine for low volumes and where the processing is not
that complicated. My understanding is that Ajax is not a programming
language, but more a forms defining language that its not nearly so
lame as HTML forms.

Your understanding is not correct. AJAX is not a language at all. It's
a word someone invented for the generic concept of having JavaScript
talk directly to the server without reloading the HTML page. There are
any number of possible ways of implementing AJAX. The most common is to
use the non-standard XmlHttpRequest class, which is available from
JavaScript in most major browsers.

The major defining characteristic, though, is the asynchronous aspect of
the technology. Even XML is in there by coincidence; people describe
things as "AJAX" applications when they don't use XML at all. There is
no new language or file format here. There's no specification; no
definition of AJAX is or is not. There are no special tools. There's
no visual appearance that could be created except what you could do with
a web browser, HTML, JavaScript, and CSS anyway. In fact, if you were
allowed to stub out the data, you could write any AJAX application with
only those basic client-side web technologies.
The main problem with using Applets is your users will be annoyed at
the start up times to do a very simple thing. They won't like be
hassled with computer geeky stuff like Applet privilege granting.

There are actually two advantages to an AJAX-like approach over applets.
One is that JavaScript generally starts faster than an applet. The
other is that AJAX is really just HTML and JavaScript and CSS, so it
ACTS like a web browser. That is, you can resize the window and expect
to see text and tables wrapped and presented in all the normal ways.
All the UI kludginess of applets is gone. That's significant, too.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
L

Luke Webber

Steve said:
gk wrote:




JSP/JSTL is server-side. AJAX is, by definition, client-side.

Not entirely. There has to be some sort of web service provider to serve
the XML back to the Javascript.

Luke
 
G

gk

my server will return 1 XML after 1 second. this XML will be written to
my web page in a table.

again after 5 secs my server will return another XML . i want to
place this XML in a table just below the above table.



again after 5 secs my server will return one more XML . i want to
place this XML in a table just below the above table.

so, my web page is getting updated. and at last there will be 3 table
contaning 3 XML's in them.


i have developed AJAX application earlier also. but this architecture
is very diiificult.



can you show me a demo on this problem with AJAX ?

though i have over-simplified the problem and presented to you. i am
getting difficuly to append the page with new XML data.

how could i do that?
 
R

Roedy Green

again after 5 secs my server will return another XML . i want to
place this XML in a table just below the above table.

The way you would do that on the client side in java is just have a
thread waiting on an open socket to the server waiting for the next
installment, OR have the client every 5 seconds send in a new request
for the next installment.
see http://mindprod.com/applets/fileio.html
for sample code.

If you want to know how to handle that in JavaScript, ask in a
JavaScript newsgroup.
 
G

gk

Roedy said:
The way you would do that on the client side in java is just have a
thread waiting on an open socket to the server waiting for the next
installment, OR have the client every 5 seconds send in a new request
for the next installment.
see http://mindprod.com/applets/fileio.html
for sample code.



YES. i can do that.

my problem is the disply problem. i can not flush a table+css+flash
with out.println()...thats very bad.

yes..u are right ...some javascript could help me to display those data
in different tables...making it an updated dynamic page.
 
R

Roedy Green

my problem is the disply problem. i can not flush a table+css+flash
with out.println()...thats very bad.

Again, that is a JavaScript problem. The place to ask is
comp.lang.javascript
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top