Okay, I know that Java is a language but somebody has asked me if they can write a web application to interface in with a web app I've written in ASP.NET. I'm implementing a web service to serve up an XML so it's pretty language agnostic.
However, I'm not 100% sure whether going down the Java route makes a lot of sense. I was kind of expecting PHP or ASP.NET server side code with maybe some Ajax/JavaScript or maybe a heavier client JavaScript program using JScript.
Could someone please explain the basic Java environment when it comes with webapps? I've inferred the following - am I barking up the right tree?
When running Java on the client, can you use JavaBeans and is there a framework? Can it also use JScript? I don't think so as JScript is JavaScript library.
While running Java on the server would be okay, this is a relatively small application and therefore Java sounds like a bit of overkill. PHP or ASP.NET feels a better fit.
But I don't think they should go down the Java applet in the browser and it adds complexity that's not needed.
Let's try to define some terms (not necessarily 100% exact, but understandable)
JScript is the Microsoft dialect of JavaScript and has nothing at all to do with Java.
By the way, JavaScript doesn't have anything to do with Java either. The only similarities are the first 4 characters of their name and a superficial similarity in syntax.
So basically: if they want to write a Java application to interface with your application that simply provides some XML, then Java is definitely suited for this. You don't need any of the Java EE technologies for this. Java SE is more than enough for this.
Edit: Note that it is a fairly common practice to not use the entire Java EE stack for (small-ish) web applications. Specifically Apache Tomcat, which is widely-used, is not a full Java EE Server (as required by the Java EE specification), but rather an implementation of the JSP and Servlet standards (two core parts of Java EE). It still runs many, many useful Java web applications just fine, because they simply don't use the more complex features of Java EE.
Java when run like ASP.NET is called JSP
This is sort of true - a traditional JSP page is a lot like a classic ASP page. There's no "codebehind" like you have with ASPX.
The big difference in Java is that the web framework is based around things called servlets. A servlet is a bit like a ASP.NET "axd" in that it handles raw HTTP requests (get, post, etc) and spits out a response.
On top of that servlet "base" are many other frameworks - JSP is one of them (JSPs are ultimately compiled by the server into servelets). JSF, Struts, Tapestry, and many others are also built on this base. In the .NET world you really have two choices - ASP.NET (.aspx pages with codebehind) or .NET MVC. Most of the Java web frameworks are more like .NET MVC, although (as I understand it) JSF is more like ASP.NET
JavaBeans is a bit like the .NET framework, i.e. it's a library of re-usable components
Not really. What you are thinking of is J2SE, which is the basic framework upon which all Java apps are built - has the collection classes, sockets, security, etc. etc. JavaBeans is just a specification for how to write DTO type objects (standard naming for getters and setters, etc.)
Java EE is a bit like ASP.NET in that it's a framework for building web pages on a server
This is more-or-less correct. J2EE is an extension of J2SE for doing web development (as well as EJB's which are a whole nother ball of wax that don't really have a direct equivilent in .NET)
Java can also run on the client but it needs the Java VM installing
Yes, this is true. Just like you can use .NET to develop desktop or web applications, you can use Java the same way. And in both cases, a runtime is required (whether thats the Java VM or the .NET framework)
As for your assessment about using Java vs. PHP vs. .NET, I've worked with all of them, and I would say Java is the most complex, but also very powerful for very large scale applications. PHP will be the easiest by far, and is great for small apps, but can get messy when things get bigger. ASP.NET has a pretty good balance. Quite a bit more complex than PHP, but also much more powerful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With