Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

AJAX versus JAVA

  1. Feb 11, 2008 #1
    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?
     
  2. jcsd
  3. Feb 11, 2008 #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: Feb 12, 2008
  4. Feb 11, 2008 #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
     
  5. Feb 12, 2008 #4
    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?
     
  6. Feb 12, 2008 #5
    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 similiar to flash. However you can easily use JAVA in the form of JSP, which is comparable to PHP, ASP, ROR, CF...
     
    Last edited: Feb 12, 2008
  7. Feb 12, 2008 #6
    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 similiar 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.
     
  8. Feb 12, 2008 #7

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  9. Feb 12, 2008 #8
    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?
     
  10. Feb 12, 2008 #9
    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.
     
  11. Feb 12, 2008 #10
    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: Feb 12, 2008
  12. Feb 12, 2008 #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?
     
  13. Feb 12, 2008 #12
    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.
     
  14. Feb 12, 2008 #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.
     
  15. Feb 12, 2008 #14
    Right, Javascript does not have this capability. You should look into stand-alone java programming if you don't want an applet.
     
  16. Feb 12, 2008 #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?)
     
  17. Feb 12, 2008 #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.
     
  18. Feb 12, 2008 #17
    How much data can I save in cookies?
     
  19. Feb 12, 2008 #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.
     
  20. Feb 12, 2008 #19
    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: Feb 12, 2008
  21. Feb 12, 2008 #20
    4k. Any larger and the IE ignores the write.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: AJAX versus JAVA
  1. Java help (Replies: 15)

  2. Ajax vs. Flash (Replies: 10)

  3. Java q (Replies: 3)

  4. Java problem. (Replies: 4)

Loading...