Java AJAX vs JAVA: A Comparison of Web Development Languages

  • Thread starter Thread starter Ulysees
  • Start date Start date
  • Tags Tags
    Java
Click For Summary
AJAX is a technique that uses JavaScript and XML to provide instantaneous responses to user inputs without reloading the page, while Java is a programming language that can be used for server-side applications. AJAX is often seen as more efficient for web applications due to its ability to handle user interactions quickly, whereas Java applets can be resource-intensive and require plugins. Both technologies can be used together to enhance web applications, allowing Java to handle server-side logic while AJAX manages client-side interactions. However, Java's server-side components, like JSP, do not update instantly without AJAX. The discussion emphasizes that while AJAX and Java serve different purposes, they can complement each other in web development.
  • #31
Ulysees said:
The topic might as well be:

"AJAX versus stand-alone JAVA"

For the hundreth time, no. You can't compare AJAX to JAVA. It's like comparing a Honda Civic to a Cessna CJ1. You can NOT communicate with a server with just AJAX (Javascript + XML). What you want to compare is client JAVA with AJAX or web JSP/J2EE with AJAX.
 
Last edited:
Technology news on Phys.org
  • #32
CRGreathouse said:
Actually that wasn't clear to me until you posted that. Your essential question, then, is about what to use on the client side -- nothing (well, nothing but styled HTML I presume), or JavaScript + XML. In either case you're using server-side Java, right?

Or have I still misunderstood?

That's it. Nothing (well, nothing but styled HTML I presume), or JavaScript + XML.

And yes, server-side java in either case. Thank you.
 
  • #33
Greg Bernhardt said:
For the hundreth time, no. You can't compare AJAX to JAVA. It's like comparing a Honda Civic to a Cessna CJ1. You can NOT communicate with a server with just AJAX (Javascript + XML). What you want to compare is client JAVA with AJAX or web JSP/J2EE with AJAX.

You don't understand how people think in business Greg. For them it's solution A, versus solution B, versus solution C (paperwork).
 
  • #34
Ulysees said:
That's it. Nothing (well, nothing but styled HTML I presume), or JavaScript + XML.

And yes, server-side java in either case. Thank you.

ah I see, that was really not clear to me either especially when you keep making your confusing A vs B comparisons.

If used correctly AJAX can be fantastic and it should be used, but if abused you can end up crippling your server. So i'd use an HTML page with some sprinkles of AJAX.
 
  • #35
I got stuck in another issue with java once. My applet was not allowed to access web pages (plain html) on servers other than the one I downloaded the applet from, "for security reasons" this was not allowed.

You know any workaround?
 
Last edited:
  • #36
Ulysees said:
I got stuck in another issue with java once. My applet was not allowed to access web pages (plain html) on servers other than the one I downloaded the applet from, "for security reasons" this was not allowed.

You know any workaround?

That's a security measure to prevent cross-site scripting - the alternative is to sign your JARs. A signed java applet will have full permissions.
 
  • #37
What about this one, -Job-:

> Is it possible to not ask the server at all, just get data straight from the cache? Because the main problem of the internet is delay, not download rate. It's a replacement for Outlook I'm trying to come up with, that interrogates the server every 5 minutes or whatever for any new messages (ie updates the cache every 5 minutes), and shows message threads immediately when requested.
 
  • #38
Ulysees said:
What about this one, -Job-:

> Is it possible to not ask the server at all, just get data straight from the cache? Because the main problem of the internet is delay, not download rate. It's a replacement for Outlook I'm trying to come up with, that interrogates the server every 5 minutes or whatever for any new messages (ie updates the cache every 5 minutes), and shows message threads immediately when requested.

You can load everything at once (e.g. load all message pages at once) and show only the active content but this is definitely not a good approach for many reasons.

The best strategy is to use AJAX (or frames) to preload content and hold it in the background until it needs to be used. For example in a mail client you can have the main page load with the first page of messages and subsequently perform AJAX requests to retrieve the next message pages so that when the user clicks to view messages 50 - 100 it can display them immediately with no load time (just some setup time). You just have to ensure that you manage the cache size and don't let it get out of control.
 
Last edited:
  • #39
But then I'd have to preload the entire forum in every session.

Can't I keep messages from previous sessions on the hard disk, just like Outlook does?

Because these days hard disk space is not an issue. Neither is bandwidth so much of an issue, unless every user downloads a ton of messages over and over in every session. The only remaining issue is delay.
 
Last edited:
  • #40
In fact I am sure there is a lot of future in this asynchronous approach, not just Asynchronous Javascript with Xml (ajax) but anything that achieves this objective, of interactivity in web pages.
 
Last edited:
  • #41
The browser can cache Ajax requests - if you ensure that the Ajax request is the same as previous ones then standard browser caching applies.
 
  • #42
-Job- said:
if you ensure that the Ajax request is the same as previous ones then standard browser caching applies.

You said this earlier:

> You can set content expiration headers on the server side to inform the browser to use cached content.

This means:

1. ask the server
2. server says "not expired yet"
3. show the cached content

We don't want this. We don't want to ask the server at all, the delay is too much. Instead, we want to show what's in the cache.

There's got to be a way to show what's in the cache from previous sessions.

Can the browser be forced to offline mode by a java applet?
 
Last edited:
  • #43
Ulysees said:
You said this earlier:

> You can set content expiration headers on the server side to inform the browser to use cached content.

This means:

1. ask the server
2. server says "not expired yet"
3. show the cached content

We don't want this. We don't want to ask the server at all, the delay is too much. Instead, we want to show what's in the cache.

There's got to be a way to show what's in the cache from previous sessions.

Can the browser be forced to offline mode by a java applet?

Really, too much delay? You have some pretty high standards. The browser makes HEAD requests which are very lightweight (contain no data) to check if new content is available - these are very fast - in addition you can also have the server set actual content expiration dates though I'm not 100% clear how the browsers handle these (they might ignore them to some degree).

IMHO I think you're getting too particular with the cache - you might be better off taking your app off the browser. You can use a single Java applet which makes socket requests to your site to retrieve content and stores it on the user's file system - so it's able to implement its own caching rules. However the main page containing the applet and the applet itself are cached (or not) according to the browser (still HEAD requests) - not to mention that the JAVA applet itself will be slower to load than any other approach. If delay is the problem then JAVA is not the solution.
 
Last edited:
  • #44
Actually I'm now reminded that Google is working on a new browser plugin called Google Gears, check it out - it's geared towards allowing applications to function offline so might be used to minimize content-related delays (it's still very much under development though). It implements a database accessible from Javascript, so you can store your content there.
 
Last edited:
  • #45
Thanks a million -Job-.

Certainly easier to convince people to install a plugin by google, than to run a windows executable of mine.

How they'd feel about giving lots of permissions to a JAVA applet is another story. Some hacker must have worked around this obstacle. But I wonder if there's a legitimate way to do it. Under the user's full supervision. Maybe the user could maintain a file and manually give it to the applet at the beginning of every session, and manually save it at the end of the session, if nothing better can be done.

Do you participate in any web-development-specific forums? Can you recommend a JAVA forum? Any AJAX one?
 
  • #46
Ulysees said:
Do you participate in any web-development-specific forums? Can you recommend a JAVA forum? Any AJAX one?

Not really - i don't have much time nowadays.
 

Similar threads

Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 33 ·
2
Replies
33
Views
8K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
Replies
27
Views
13K
  • · Replies 129 ·
5
Replies
129
Views
25K
  • · Replies 18 ·
Replies
18
Views
4K