masugidsk8r 0 Report post Posted April 24, 2007 Source article from Sun: http://www.oracle.com/technetwork/java/index.htmlWell, from this article, it shows that Ajax can be achieved with Java using Java Servlets or JSP's.For those who don't know what AJAX is, it's an object in Javascript technology that allows for instant communication between client-side and server-side. It's like changing a page's content without having to reload the whole page.Let's move on... Now when I looked at the JSP source code, the servlet's function was to simply validate a text and send back a response in XML format. That's basically all what it needed to do.It required a lot of lines to obtain the information from the HTTP Request, connect to a database, validate the object passed through the URI and send back a response in XML.After looking at the code and understanding it, I thought to myself, "Why not do this in PHP? Can't I achieve the same thing in PHP with a lot less lines!?"As far as I know, I believe so. If PHP can obtain a variable using $_GET or $_POST method, connect to database using MySQL, validate it, and send back a response in XML-format--with even less lines than JSP, why not do it?My concern is, can PHP replace the JSP source code found in that article? Wouldn't I be able to achieve the same result with PHP?---PHP is a great OOP language and it's a powerful language. I think I can stay using PHP with AJAX over Java. If there are those who would like to disagree, please tell me the advantage of using Java Servlets (JSP).Thank you. Share this post Link to post Share on other sites
hitmanblood 0 Report post Posted April 24, 2007 I was just reading this article when I saw your post on the forum. I think you can do it with the php in fact I assume it is not problem at all (I won't try but there shouldn't be any obstacles in your way). However your price would be speed because the emphasizes here is on the speed and the fact that you don't have to reload page once again to change its content and that is true however you would have to load page if you are about to change it with php. Or at least specific part of page as like frame or pop up window. This is my oppinion I would like to hear what do you think is it valid I mean the speed sacrifice, against this implementation. Because they presented really nice merge of technologies over there. Share this post Link to post Share on other sites
masugidsk8r 0 Report post Posted April 24, 2007 Hitman, what I'm trying to say is that my PHP file would replace JSP. I can still achieve AJAX because it's Javascript. Instead of connecting the AJAX object to a JSP, I connect it to a PHP page and achieve the same result. I've tried it and I didn't have to reload the page.The PHP script would be back-end not front-end that's why the user won't have to reload the page (thanks to AJAX).A better combination (in my opinion) is: XHTML/Javascript(AJAX)/PHP instead of: XHTML/Javascript(AJAX)/JSP(JAVA) Share this post Link to post Share on other sites
ramandhingra 0 Report post Posted August 2, 2007 if u can compromise using php over jsp.. then, u better go for asp.. coz, in asp.. xml is built into from the beginning.. all the responses in asp(.net) are xml responses.. Share this post Link to post Share on other sites