views:

463

answers:

5

Can someone tell me please does JSP display good performance when building a website with it?

Can it be as fast as PHP?

The reason I am asking is because I see these days everybody is building their front ends with PHP or ASP.NET.

Since I am a Java developer I really want to be able to build the application in Java as the backend and the frontend in JSP.

+1  A: 

JSP can actually be quite faster than PHP from everything I've read and the few benchmarks I've done. Check this site out: http://shootout.alioth.debian.org/

Alexander
+2  A: 

I don't think you'll have any performance problems with JSP.

But keep in mind that JSP alone is not a complete frontend technology.

You should keep all business logic (or better yet: all calls to business logic) in Servlets (or Actions, if you use an additional frontend) and really keep just the presentation in JSPs.

Many beginners make the mistake of coding their logic in their JSP pages, which quickly becomes an unmaintainable mess.

Joachim Sauer
A: 

Keep in mind that good Java web hosting isn't usually so cheap as PHP hosting (JVM simply needs more resources [memory] to run than PHP).

Peter Štibraný
+1  A: 

Performance wise there is not much difference between PHP, ASP, JSP or whatever. As mentioned before, getting your Java web app hosted might be a problem. Most out of the box hosting providers just don't have a servlet engine like Tomcat or Jetty as part of their standard service offering.

Having experience with both PHP and Java (JSP), I've noticed that to get up and running with JSP takes a lot more effort compared to PHP. Running a Java web app is something you really must want otherwise you'd probably give up early on in the process. PHP is easy, just put a PHP script in your web-root folder and off you go. But then again, PHP has it's dark side as well (syntax).

Java can be a lot more powerful. Especially when you get into the realm of Enterprise solutions (large, distributed and modular corporate software systems). It's therefor that Java is used mostly in that area instead of PHP (all though Yahoo! is a good example of a large business that does a lot with PHP).

Whether you decide to use Java or PHP, one thing you should do is use a framework of some sort. No need to reinvent the wheel here. For PHP there is e.g. CodeIgniter, KohanaPHP and CakePHP and in the Java realm you might want to look at Struts 2, Stripes and Spring.

Luke
A: 

Everyone talks about how JSP is harder to get set up then PHP, this maybe true, but you should look into appfuse lite, it will help you get your spring/ibatis setup running in about 15 minutes. It has about 80 different configurations, so you can pick and choose what you want to have for a container and ORM etc.

mkoryak