I've been working on Java based on J2EE API for more than 2 years. I found that Java is excellent if you need to develope a huge enterprise system, e.g the development of the middle tier based on EJB, Java Bean that captures the business logic (hosted on application server, e.g BEA weblogic, IBM websphere, Oracle Application server etc.) which can be used across by multiple types of client e.g the windows-based client based on SWING,the Java Applet,and the servlet/JSP (Web based).
A gool real world example is that an intranet ERP system that consists of inventory, hr, CRM modules etc. can have the middle tier developed using EJB/JavaBean , and the extension to Internet B2B,B2C,B2E e-business structure is very much simple, you need to develope only the client based on Servlet/JSP that provides public internet access thru the same business logic, transaction handling etc. To develope a system like this, a big team of developer is needed.
If you intended to develope only an e-commerce web site or content/entertainment portal, I recommend that PHP is the choice, as it is simpler , easy to catch up, I catched up php within 2 hrs (from my experience on JSP/Servlet),on the other hand php provides only one layer,if your site needs often changes of content, and logic , you can simply change it within the php page scripting instead of you need to change your EJB beans,re-compile and re-upload to the EJB server etc.
By the way you can also program based on 1 layer using JSP as the same as PHP, but this downgrades the OO features & design, layer abstraction, that provided by Java.
My own example here is I adopted J2EE (EJB,JavaMail,JSP/Servlet) for the development of our company's B2C,B2B e-commerce web site that needs to link to the Internal ERP system, I chose PHP for my own content/entertainment portal (for personal interest only, to be launched soon 😛), the choice of the technology very much dependent what U need ....