views:

149

answers:

3

I have done a lot of web development using PHP (both procedural and OO). I have in the last few years been involved in Java development (not JSP and Servlets) for embedded systems. I am pretty proficient using Java SE and have recently scored a nice web dev job. I am thinking of developing this site using JSP and Servlets but this is strictly for my own knowledge progression using Java. Is there any real reason to use JSP and Servlets over PHP or ASP etc?The problem being that a lot of Hosting companies do not offer e.g. Tomcat or other JSP servers and if they do, it's expensive.

Any feedback would be appreciated.

GF

A: 

If you've got the time, it's a good idea if only to learn the web aspects of Java. I'd suggest looking at a Java web framework such as Spring MVC, Wicket, or Struts, as they simplify development (after you learn them) and make web apps more testable and maintainable.

Kaleb Brasee
Could you recommend one over the other?
Grungefreak
Choosing one java framework over the other doesn't really answer the question of choosing Java over PHP/ASP, though.
skaffman
A: 

Comparing JSP with PHP is a bit comparing apples with oranges. Comparing JSP with ASP is more reasonable as they both are less or more in the same line of technology/ideology. I am not going to compare JSP and ASP here as I don't do ASP and I prefer to post answers based on own knowledge and experience.

PHP is pretty low-entry and easy to get started with with regard to web development. It's relatively easy to build/edit PHP pages. Also PHP hosting is extremely cheap and even freely available. The language itself is however weak typed and not really targeted on OO development and pluggability. For that Java/JSP is a better choice. It eases separation of view from model and controller (backed by Java code) by using tag libraries and just adhering some coding practices. For Java/JSP there are also extremely a lot of robust libraries/frameworks available which you could just plug/adopt. Also multithreading, concurrency and background processing is much easier and better to be done/managed with Java code. It's only a bit more work with regard to development and publishing (edit, rebuild/recompile, redeploy and in some cases also restart of server instead of just edit and save as in PHP).

With regard to JSP/Servlet hosting, none of them is free (although only Eatj.com has a free account, but that's a trial which will shutdown the webapp automatically after half a hour), but they aren't necessarily expensive. The cheapest ones starts with prices in range of $10~$15 per month (which I consider pretty affordable, it may be different for you). E.g. javaservlethosting.com, jsp-servlet.net and eatj.com. Then there are web clouds like Amazon EC2 and Google App Engine with variable prices depending on under each actual CPU usage and network bandwidth.

BalusC
+2  A: 

I've been using JSP for years and the extensibility generally makes the nominal cost for monthly hosting more than worth it. That said, if you need to put up a basic informational or resume type of page, you're probably not going to need JBoss or some other sledgehammer.

With JSP/Java, it opens the door to using Java in the controller layer (you probably already used or have heard about advanced connection pooling, distributed caching, scheduling via Quartz, Hibernate object/relational persistence). And then you can run Java on any machine with a JVM. The syntax on JSPs isn't incredibly difficult, though it does have a learning curve. As far as hosting, eatj.com has been pretty good so far.

On the PHP side, you can easily incorporate community features like Wordpress. While you can use nWordPress for Java, it's just not the same thing. Facebook, probably one of the biggest implementations of PHP out there, uses HipHop and decreased their processor requirements dramatically.

Your project may also also have an easier time getting staffed with PHP developers since they are relatively more easy to come by than JSP developers. I'd say learn JSP and/or Ruby - it opens up a few more doors and you may eventually prefer one method over another.

bphilipnyc