AJAX vs JAVA: A Comparison of Web Development Languages

  • Java
  • Thread starter Ulysees
  • Start date
  • Tags
    Java
In summary, AJAX suffers from the fact that 90% of development time is spent trying to work around intricacies of specific platforms, but JAVA can still be used to build a system like PF with AJAX techniques.
  • #1
Ulysees
516
0
Which one is better?

It turns out that AJAX suffers from the fact that 90% of development time is spent trying to work around intricacies of specific platforms, which is why google came up with a library that converts JAVA applets into AJAX code.

But why not stick with JAVA anyway? Can't JAVA produce a site that looks like this forum? Can't it provide all the same functionality but in different code, and much more responsively?
 
Technology news on Phys.org
  • #2
You can use both together. You could certainly build a system like PF with JAVA (JSP...J2EE). AJAX is a technique rather than it's own language. The technique utilizes XML and Javascript to process a user request immediately instead of having to refresh the page. So yes you can use JAVA and AJAX together to create a system like PF.

Google likely created a library to convert applets to javascript because applets are resource hogs, have poor usability and need plugins to operate. Javascript is platform independant as well.
 
Last edited:
  • #3
I think JAVA would much slower than AJAX for creating a forum like PF. Much slower. HTML loades much faster than a JAVA applet. But I guess applets could be designed to load faster.AJ
 
  • #4
ajsingh said:
I think JAVA would much slower than AJAX for creating a forum like PF. Much slower. HTML loades much faster than a JAVA applet. But I guess applets could be designed to load faster.

It's a different way of doing things, AJAX downloads first a lot and then interacts instantaneously, like FLASH. JAVA has the same philosopy by default.

But all JAVA applets I've seen look like FLASH graphics or windows dialog boxes, not browser text.

Anyone know if browsable forum text can be done with JAVA?
 
  • #5
Ulysees said:
It's a different way of doing things, AJAX downloads first a lot and then interacts instantaneously, like FLASH. JAVA has the same philosopy by default.

But all JAVA applets I've seen look like FLASH graphics or windows dialog boxes, not browser text.

Anyone know if browsable forum text can be done with JAVA?

Ulysees, did you read my post at all? You are really confused and I suggest you do some research on the technologies in general. You can't compare AJAX and JAVA. They are apples and oranges. But you can use them together to make a great smoothie :smile:. JAVA is a programming language. AJAX is a programming technique that uses javascript and xml. You can build a forum with JAVA with AJAX techniques, but you can't build a forum with just AJAX (javascript and xml).

If you want to use an applet then yes it is fairly similar to flash. However you can easily use JAVA in the form of JSP, which is comparable to PHP, ASP, ROR, CF...
 
Last edited:
  • #6
Greg Bernhardt said:
Ulysees, did you read my post at all? You are really confused and I suggest you do some research on the technologies in general. You can't compare AJAX and JAVA.

Tell that to a customer who wants to offer a geographical system like google maps. It could be done, for example:

- As many pictures that are shown when you click on links in HTML

- As a WIN32 application that downloads maps into memory and shows the bit you're looking at.

Is customer allowed to compare WIN32 with plain HTML or is it apples with oranges?

I am aware of the philosophy of AJAX, which is all about using standard web things like javascript xml and asp in a way that gives instantaneous response from user input.

JAVA, I've only used as a substitute for C++ in desktop applcations, so I wonder if it can control the display of text in a browser like javascript does, that's my question.

> If you want to use an applet then yes it is fairly similar to flash. However you can easily use JAVA in the form of JSP, which is comparable to PHP, ASP, ROR, CF...

Not sure what this parade of acronyms is saying to its users, but for me, does JSP look like physicsforums.com?

Does JSP respond instantaneously, ie you get from the server all new forum posts and show the user the topics he clicks on instantaneously?

In fact I wanted to design forum software like this. It would be super-responsive, it would be held on member's local hard disks, members would be able to ignore certain categories, etc.
 
  • #7
AJAX can be compared to (client-side) Java applets or to server-side Java like J2EE. Server-side Java can be used with AJAX, or a Java applet can transfer data to a server with XML (though not AJAX per se), but that's about it.
 
  • #8
Ulysees said:
I am aware of the philosophy of AJAX, which is all about using standard web things like javascript xml and asp in a way that gives instantaneous response from user input.

JAVA, I've only used as a substitute for C++ in desktop applcations, so I wonder if it can control the display of text in a browser like javascript does, that's my question.

> If you want to use an applet then yes it is fairly similar to flash. However you can easily use JAVA in the form of JSP, which is comparable to PHP, ASP, ROR, CF...

Not sure what this parade of acronyms is saying to its users, but for me, does JSP look like physicsforums.com?

Does JSP respond instantaneously, ie you get from the server all new forum posts and show the user the topics he clicks on instantaneously?

It's important you mention ASP. ASP is what you can compare to JAVA (JSP) not AJAX. You can use both ASP or JSP in conjunction with AJAX. AJAX is a client side technique (meaning you can't push data to a user) to run ASP or JSP scripts without having the user reload the page. And yes you could create a site just like PF using JSP. But since JSP is server side it will not update instantly. But you can use JSP with AJAX to update instantly. Understand?
 
  • #9
Greg Bernhardt said:
It's important you mention ASP. ASP is what you can compare to JAVA (JSP) not AJAX. You can use both ASP or JSP in conjunction with AJAX. AJAX is a client side technique (meaning you can't push data to a user) to run ASP or JSP scripts without having the user reload the page. And yes you could create a site just like PF using JSP. But since JSP is server side it will not update instantly. But you can use JSP with AJAX to update instantly. Understand?

You mention JSP scripts. Is JSP an acronym for javascript? If yes, then it's not suitable for what I want, because I want a super-responsive version of physicsforums where you only download new posts, but javascript cannot save data onto hard disk. So you'd have to reload too much every time you go to the site, in order to have fast interactive access to all topics. So what I want is like an email client for forums posts, that displays forum posts on web format.
 
  • #10
Ulysees said:
You mention JSP scripts. Is JSP an acronym for javascript? If yes, then it's not suitable for what I want, because I want a super-responsive version of physicsforums where you only download new posts, but javascript cannot save data onto hard disk. So you'd have to reload too much every time you go to the site, in order to have fast interactive access to all topics. So what I want is like an email client for forums posts, that displays forum posts on web format.

I see now. JSP is "Java Server Pages" and is equivalent to ASP but in Java scripting form. You're better off using a language for client application development (C++, JAVA,VB ). AJAX is Javascript btw. So in conclusion you could still use AJAX with your application development, but it still needs a server side component. So you could develop an application using JAVA, JSP and AJAX together. But now that I'm thinking, you could prolly just use regular client JAVA functions, you don't need JSP or AJAX.
 
Last edited:
  • #11
> So in conclusion you could still use AJAX with your application development, but it still needs a server side component

How will I save messages onto client hard disk?
 
  • #12
Ulysees said:
> So in conclusion you could still use AJAX with your application development, but it still needs a server side component

How will I save messages onto client hard disk?

You'll have to read up on the JAVA functions. I'm sure there is a function for saving data onto the hard drive or atleast reading from an online database.
 
  • #13
I tried this with javascript once, and it didn't exist, "for security reasons". Java applets, probably have the same problem, and they don't look like physicsforum.com, they look like flash.

Can't believe it is so hard to save on disk on the client side. There's got to be a way.
 
  • #14
Ulysees said:
I tried this with javascript once, and it didn't exist, "for security reasons". Java applets, probably have the same problem, and they don't look like physicsforum.com, they look like flash.

Can't believe it is so hard to save on disk on the client side. There's got to be a way.

Right, Javascript does not have this capability. You should look into stand-alone java programming if you don't want an applet.
 
  • #15
Well the whole idea is something that works without users installing anything, just use their browser, and enjoy interactivity like that of googlemaps. Googlemaps reloads maps every time you visit, my forum has to only load each piece of data once and save it to disk (or cache?)
 
  • #16
Remember JSP, ASP, PHP, all of these are what they call stateless connections. Java runs in it's JVM and can maintain state with the server, the others must make round trips to the server. To "save messages" your going to have to maintain somesort of state on the client machine. Cookies are a way, or have the server maintain a message read/not read list for each unique user. This is one of the biggest pains with web technologies. With a java applet running inside a JVM your essentially running a stand alone, statefull application that can interact with the server, and the client file system just like any other W32 app.
 
  • #17
How much data can I save in cookies?
 
  • #18
I don't believe there is any real limit, I could be wrong, but remember a cookie is only a text file. You would have to parse the thing with somesort of delimiter to substitute for a table. If the forum was any kind of size this file would get huge fast. That's why they are normally only used to maintain user ID's and configuration data. The other alternative is for maintain this on the server's DB, which I do believe is how this forum tells what posts you've read, not read. Like I said, maintaining state is a huge pain and will get in the way of a lot of your "stand alone" application previous thinking.
 
  • #19
Ulysees said:
Well the whole idea is something that works without users installing anything, just use their browser, and enjoy interactivity like that of googlemaps. Googlemaps reloads maps every time you visit, my forum has to only load each piece of data once and save it to disk (or cache?)

Then you'll need either flash or a Java applet. Googlemaps works because it uses a server side language too. Not sure what it is, but PHP, ASP, JSP would all work just fine with AJAX. So you could use JSP and AJAX, but it wouldn't be able to save anything to disk directly. At most it would be a save file prompt.
 
Last edited:
  • #20
Ulysees said:
How much data can I save in cookies?

4k. Any larger and the IE ignores the write.
 
  • #21
Ulysees said:
Well the whole idea is something that works without users installing anything, just use their browser, and enjoy interactivity like that of googlemaps. Googlemaps reloads maps every time you visit, my forum has to only load each piece of data once and save it to disk (or cache?)

You should let the browser do most of the caching. You can set content expiration headers on the server side to inform the browser to use cached content.
 
  • #22
CRGreathouse said:
AJAX can be compared to (client-side) Java applets or to server-side Java like J2EE. Server-side Java can be used with AJAX, or a Java applet can transfer data to a server with XML (though not AJAX per se), but that's about it.

I wouldn't compare Ajax, or javascript, with Java because in terms of capabilities they're very far apart. Java applets can be granted full access to system resources, and perform any range of functions (including hardware manipulation). They're also completely different languages in orientation.
 
  • #23
Also Google created a translator between Java and Javascript, but it's not meant to be used to convert Java applets to Javascript - because you can't, javascript doesn't have sufficient capabilities. The goal is to be able to program javascript using Java, an Object Oriented language, and use the advantages therein.
 
  • #24
-Job- said:
You should let the browser do most of the caching. You can set content expiration headers on the server side to inform the browser to use cached content.

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 speed.
 
  • #25
-Job- said:
Java applets can be granted full access to system resources, and perform any range of functions (including hardware manipulation).

Hardware manipulation from java applets running in the browser? Or are you talking about stand-alone java? If java applets support hardware manipulation, then why can't we write to disk from them?

By the way. Do you know the function calls to access the microphone from a java applet running in the browser?
 
Last edited:
  • #26
Ulysees said:
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 speed.

How do you fill the cache and communicate what's in the cache without hitting the server at some point? Also, if you are working from cache, the information won't be up to date, especially for a community.

Ulysees said:
Hardware manipulation from java applets running in the browser? Or are you talking about stand-alone java? If java applets support hardware manipulation, then why can't we write to disk from them?

By the way. Do you know the function calls to access the microphone from a java applet running in the browser?
You can access hardware form an applet, but for most machines you'll need to get permissions, aka a security popup. Again an applet will be bulky and much like flash.

Try something like Microphone.get();
 
  • #27
-Job- said:
I wouldn't compare Ajax, or javascript, with Java because in terms of capabilities they're very far apart. Java applets can be granted full access to system resources, and perform any range of functions (including hardware manipulation). They're also completely different languages in orientation.

Oh sure, I agree completely -- but at that point in the thread it wasn't clear whether the original poster was asking for a client-side replacement (Java applet) or a server-side one (J2EE). My only purpose was to probe as politely as I could toward the purpose, since it's hard to coherently answer the question without understanding that point!
 
  • #28
>> 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 speed.

> How do you fill the cache and communicate what's in the cache without hitting the server at some point?

Well you'd only want hit the the server once. With Microsoft Outlook, do you hit the server every time you read an email? No, you just hit it once every that many minutes, and then it's fully interactive. So it's a replacement for Outlook I'm trying to come up with. Except the user sees the forums in the browser in the form that they do now.

> You can access hardware form an applet, but for most machines you'll need to get permissions, aka a security popup.

Do you have any examples? A site I can visit that presents security popups of java applets doing fancy things with hardware?
 
  • #29
CRGreathouse said:
Oh sure, I agree completely -- but at that point in the thread it wasn't clear whether the original poster was asking for a client-side replacement (Java applet) or a server-side one (J2EE).

CRGreathouse, it was explained in page 1:

Ulysees said:
Tell that to a customer who wants to offer a geographical system like google maps. It could be done, for example:

- As many pictures that are shown when you click on links in HTML

- As a WIN32 application that downloads maps into memory and shows the bit you're looking at.

Is customer allowed to compare WIN32 with plain HTML or is it apples with oranges?

I've only worked with JAVA as a substitute for C++ in desktop applications.

The topic might as well be:

"AJAX versus stand-alone JAVA"
 
Last edited:
  • #30
Ulysees said:
I've only worked with JAVA as a substitute for C++ in desktop applications.

The topic might as well be:

"AJAX versus stand-alone JAVA"

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?
 
  • #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:
  • #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:

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
33
Views
8K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
5
Views
4K
  • Programming and Computer Science
Replies
18
Views
4K
Replies
27
Views
13K
  • Programming and Computer Science
4
Replies
129
Views
24K
Back
Top