Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

problem in AJAX

Thread view: 
gk - 26 Oct 2005 10:21 GMT
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.
Roedy Green - 26 Oct 2005 11:26 GMT
>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

gk - 26 Oct 2005 11:53 GMT
> >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.
[quoted text clipped - 14 lines]
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Java custom programming, consulting and coaching.

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.
gk - 26 Oct 2005 12:34 GMT
and if i dont store the data in java bean then later on i wont be able
to sort it.
Roedy Green - 26 Oct 2005 12:58 GMT
>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Chris Smith - 26 Oct 2005 17:41 GMT
> 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.

Signature

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Roedy Green - 27 Oct 2005 00:23 GMT
>Your understanding is not correct.
thanks for sorting that out.  I have rewritten the entry based on
your post.  See http://mindprod.com/jgloss/ajax.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 26 Oct 2005 13:11 GMT
>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Steve Sobol - 26 Oct 2005 15:45 GMT
> 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.

Signature

Steve Sobol, Professional Geek   888-480-4638   PGP: 0xE3AE35ED
Company website: http://JustThe.net/
Personal blog, resume, portfolio: http://SteveSobol.com/
E: sjsobol@JustThe.net Snail: 22674 Motnocab Road, Apple Valley, CA 92307

Luke Webber - 27 Oct 2005 05:33 GMT
>> 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.

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

Luke
gk - 27 Oct 2005 06:38 GMT
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?
Roedy Green - 27 Oct 2005 07:18 GMT
>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

gk - 27 Oct 2005 07:29 GMT
> >again after 5 secs my server  will return  another XML . i want to
> >place this XML in a table just below the above table.
[quoted text clipped - 5 lines]
> 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.

> If you want to know how to handle that in JavaScript, ask in a
> JavaScript newsgroup.
>
> --
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 27 Oct 2005 07:49 GMT
>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
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

TechBookReport - 26 Oct 2005 11:38 GMT
> AJAX sends XML response. and javascript function parses that XML
> response and then HTML DOM  is updated.
[quoted text clipped - 15 lines]
> 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

Signature

TechBookReport Java book reviews
http://www.techbookreport.com/JavaIndex.html

Steve Sobol - 26 Oct 2005 15:44 GMT
> 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?

Signature

Steve Sobol, Professional Geek   888-480-4638   PGP: 0xE3AE35ED
Company website: http://JustThe.net/
Personal blog, resume, portfolio: http://SteveSobol.com/
E: sjsobol@JustThe.net Snail: 22674 Motnocab Road, Apple Valley, CA 92307



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.