Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servelts and jsp

 
Preeti Sikri
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends
I'm m=new to JSP and I have used JSP with java Neans can anyone pls tell me how can I work on servelts with JSp ..
is there any tutorial available on web
any help wld be great thanks regards
Preeti
 
Daniel Olson
Ranch Hand
Posts: 81
 
Arunagiri, Shanmugham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
JSP is an embeded script written in HTML with the file name saved as < filename.jsp >. It is nothing but
JSP = HTML + Servlet.
Only thing u have to remember is that all the servlet codes should be inside the JSP tags. And u dont have to include all the servlet packages like HttpServletRequest etc. They are all included by default. So u can strait away start coding serlvet.
For u to have a small idea... try this out
Test.jsp
<html>
<% out.println("Hi from JSP "); %>
</html>
Hope this will start u a little.
Arun
Sun Certified Programmer for Java2 Platform
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP is a little more complicated than that.
JSPs are HTML pages which include Java code thich is embedded within scriptlet tags <% %>
When a JSP is first accessed it is compiled into a Java Servlet ...
My favourite things about JSPs are.
1. It helps you seperate presentation from logic.
2. you don't have to write endless out.print("<HTML>"); statements.
3. Certain important objects are implicitly included in JSPs such as request and session. There is no need to explicitly instantiate / retrieve these objects.
I generally use JSPs as a presenation layer, I use Javabeans to hold presentation data and servlets for logic ... this is basically what the Model 2 architecture is all about and in my opinion makes the best use of all three technolgies.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic