first of all let me make it very clear that internally when jsp is excuted by server it get converted to servlet. So the way servlet and jsp work is almost similar. For both you need to have basic understanding of servlet life cycle and ofcouse knowledge of java. Coming to when to use servlet or jsp. when your purpose is to render page at user end go for jsp, else if your purpose is to do some server side validation such has database updatation etc. go for servlet. But i want to put one point over here is that both the objective can be achived by jsp or servlet. -arun [ February 01, 2002: Message edited by: arun boraiah ]
dear arun may i have the opportunity to share something regarding the question thrown by you.
servlets are a very LOW-LEVEL programming jsp is HIGH-LEVEL programming having said that, the greatest advantage/purpose of jsp is to place a hidden or unseen wall of abstraction between presentation and implementation. this task was not achieving fully in servlets. thanks take care from sk!!
Simply put in most cases you will use JSP and Servlets together. JSP helps separate the Java coders from the HTML designers. Imagine if you will that you have a Home page that has about 100 lines of HTML and a 10 line table that is dynamically generated by selections made by the user. If you used a servlet that is fine but in order to output those 100 lines you are going to be using a LOT of println statements to facilitate that static content. Plus you have to incorporate the code that generates the dynamic table. Why not drop the HTML into a JSP page and create a servlet that generates the dynamic code. Just use the JSP tags and scripting to call the dynamic content from the servlet. This way the Java code is separated from the HTML and JSP design elements. THere are a number of advantages for doing this. 1 you separate the Java code from the HTML (you should do this as much as possible). THis allows the Java programmers to dotheir job with out getting in the way of the HTML designers. THe HTML designers are able to modify the Page with out too much of a learning curve for the scripting elements. 2 More easily maintained. Java Coders can maintain the Java code and the HTML designers can manage the display content separately. Just a couple of examples =). For simple projects, sure you will use JSP and Servlets exclusively but with more complex and intricate projects you should use a combination of the two. Hope that helps
Arun Vethadas .T
Joined: Dec 13, 2001
Hai Thanks for tips. It's really very helpful to me. Thanks for everyone. Bye. Arun.
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