This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm a software engineering student. I have a couple of years of intense experience with Java SE, and now I'm looking to learn something new. I wanted to focus on servlets, which seem the proper way to work with servers and Java technologies. I've been thinking of an example I could implement and I've came with the following one: a small scale simulation of the core of an online shop, like Amazon for example. The users could buy stuff either through the webpage or through mobile applications. I'd have a Java SE-based daemon to listen for the requests from the mobile applications, and then if all conditions (payment stuff and so) are met, the daemon runs the servlet which processes the bought, acting on a database or something. If the boughts are performed through the webpage, the conditions would be check on it with a typical buying module, and on success the servlet would be run.
Jorge Antonio Diaz-Benito Soriano wrote:I'd have a Java SE-based daemon to listen for the requests
No. The server is not something that you would write -- you'd use one of the existing servlet containers: Tomcat, Resin, Glassfish, etc. Servlets are executed by the servlet container, not by your own code.
This said, is this what servlets are used for?
Yes. Servlets are part of the server-side solution (along with JSP, beans, JDBC or ORM and more), but not in that way that you are currently thinking.
There is a lot of difference between Java SE and Java EE (formerly J2EE). It's the same Java language, the same core classes, but JEE adds a very large set of JEE-specific classes to the core class set. So to start with, get a good book on J2EE or JEe and learn the theory before you start coding. You need to understand how HTTP works, what a WAR is, and a lot of other stuff.
To actually begin working with Java EE, you need a suitable server, and if the goal is to implement a JEE webapp, then you definitely don't want to spend the time writing your own server. One of the most popular "starting" J2EE servers is Apache Tomcat. It doesn't incorporate the full J2EE/JEE feature set, but it does support the core JSP and servlet functionality. In fact, it incorporates it so well, that Tomcat is often embedded within full-stack implementations such as JBoss and JoNaS.
Tomcat is (probably) easier to get set up and working than most of the full-stack server systems, and is generally MUCH faster to start up and shut down (which is handy when you're doing a lot of experimental stuff). And I hear that the JavaRanch provides pretty good help for people with Tomcat problems.
An IDE is no substitute for an Intelligent Developer.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com