• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what should i use servlet or jsp

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir

Suppose a project has been asigned to me. How will i know that whether i have to used servlet or jsp.

with regard

Arun kumar maalik
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't choose one or the other. You use both to their best advantages.

Perhaps, this article on web application structure might be helpful.
[ August 24, 2006: Message edited by: Bear Bibeault ]
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And quite possibly you should use neither.
If you need to ask this question that's the most likely answer and you should tell them you don't have the skills to complete the project.
 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello arun, to begin with, i am an amateur, and have just started a project. i have tried my best to answer.

MVC pattern would be the answer to your question. leave all the business logic to model(POJC, EJB), presentation logic to jsp, and control(servlet) as a mediator between view and model. Though you can call model from view, it' a bad practise.
Think of jsp as a dymnamic HTML page that clients see(ofcourse, that what they are developed for). with dynamism comes the scripting. don't use secripting in jsp, use ELs, tags etc.,instead.

so, to epitomize, use all the three (jsp, servlet, and POJC or EJB).

thank you and see if it's enough, else reply.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Servlets to handle the incoming request, inspect the request, and figure out what the heck the client wants you to do.

Use a JSP to format a nice HTML or WML page to be sent back to the user.

If it's not control logic, which sho uld be in the Servlet, or display logic that should be in the JSP, use a JavaBean or POJO or even an EJB.

You can do it, dude!

Here are some good multimedia presentations on creating Servlets and JSPs using WSAD and IRAD. Even if you're not using those tools, the code still applies.

http://www.technicalfacilitation.com/get.php?link=wsad

Good luck!
[ August 27, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic