Been using PHP to develop Website that require access to either Oracle or MySQL databases. It's easy and a lot of Internet Service Provider support PHP/MySQL platforms, yet not so many support JavaServlets.
I prefer Java and always wanted to migrate to my website development Servlets/JSTL.
Is this a wise decision? Is there a better combination of software apps to develop website using JAVA?
Most site I help develop with are not mobile sites, usually used by mid-sized companies for administration/inventory using MySQL.
There are several different approaches to webapp design in Java. In general, however, you should strive for the Model/View/Controller approach. It makes life a lot simpler and it makes both design and maintenance cheaper.
PHP, is, unfortunately, not the best background for learning that. PHP traditionally has embedded the Controller logic and Models directly in the View (php page), or fudged it by having display PHP pages (view templates) connected to non-display (logic) PHP pages.
In Java, the languages for View templates (JSPs and such) is completely different than the language for the Controllers and Models (java). Each is more directly suited to the task at hand instead of trying to be everything to everybody.
Incidentally, JSPs were a "relatively" late addition to J2EE. Originally all you had was servlets and they had to generate the response HTML in its entirety. Those were grim times.
Now you can use JSPs as View Templates and servlets as your Controllers. JSTL is optional, but avoid JSTL that puts application logic onto the JSP, and in particular, don't access databases directly from the JSP.
You can use the Apache Struts framework, augmenting JSP page templates with custom Struts tags, using the Struts servlet to dispatch to action classes.
You can use JavaServer Faces with xhtml View Templates (these are not JSPs!), the FacesServlet, and write POJO Model/business logic classes. JSF is part of the JEE standard. In JSF you don't write Controllers, since they come pre-written in the form of the FacesServlet and JSF tag implementations.
You can use the Spring MVC framework, which is quite popular around here.
You can use a third-party framework such as Wicket, which uses extended HTML for View templates.
You can use a more exotic framework such as Cocoon, which works using XML workflows - although I haven't heard much about Cocoon lately.
And these are just the ones that come to mind for me at the moment.
Again, Model/View/Controller is preferable. JSF is virtually 100% pure MVC, Struts uses an incomplete form known as Model2, and I can't speak for the other frameworks offhand. And if you're one of those who chooses to build/debug/maintain/support your own framework from scratch, it's up to you.
Also, you said "web sites", so this is what I recommend for apps that are primarily into data entry and display. If you'd asked about messaging or web services webapps, I'd give a different answer.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
posted 2 months ago
Wow! Thanks. Servlets/JSP is probably the method I'll use. I have some experience with them.
Some PHP developers tried to convince me that MVC architecture was possible. I never bought it.
I use Java, (a lot of Lists & ArrayLists), to work on the database. Much more efficient to bundle the return data.
My only other concern is finding a Web Host that will support an Website using JAVA Servlet / JSP at a reasonable cost. I have to sell this to my clients.