Java server pages

1,725 views

Published on

JSP-java server pages

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,725
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
32
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java server pages

  1. 1. JAVA SERVER PAGESDynamic WebContent With Ease 1
  2. 2. Let’s Learn JSPNow What The Heck Is JSP 2
  3. 3. Introduction• JavaServer Pages (JSP) is a Java technology that helps software developers serve dynamically generated web pages based on HTML,XML, or other document types.• Released in 1999 as Suns answer to ASP and PHP . 3
  4. 4. ComparisonFunction/Feature JSP PHPProgramming Completely Object Scripting languageApproach Oriented but way too with Object Oriented descriptive. Support.String and data Rich library Rich Functionality .manipulation Inbuilt support to include third party libraries from other languages.Learning curve It helps if you have an If you know C/C++, decent understanding then you are halfway of JAVA and its through to learn PHP. architecture.Web Oriented Inbuilt Functionality Inbuilt FunctionalityFeatures but way too much of but less lines of code code. and less time to build an application. 4
  5. 5. Advantages of JSP• Versus Active Server Pages (ASP) JSP is portable to other operating systemsand Web servers; you aren’t locked intoWindows.• Versus Servlets It is more convenient to write (and tomodify!) regular HTML than to have a zillionprintln statements that generate the HTML. 5
  6. 6. Let’s Dive into the World of JSP • What are JAVA servlets ? Servlets are java programs that run on a web server and are user to make webpages on a fly (dynamic). • Advantages of Servlets : Powerful ,portable and Cheaper than many other alternatives . 6
  7. 7. •So aren’t JSP and Servlets the Same ..• 7
  8. 8. The Difference• Servlets, make you generate the entire page via your program, even though most of it is always the same. JSP lets you create the two parts separately.• So everything a servlet can do JSP can and further it is more easier to write .• Developers & Designers at there best . 8
  9. 9. Let’s a build a basic app • Setup and Installation Step 1. Download and install a Java Developer Kit. Step 2. Download and install the Apache- Tomcat web server. Step 3. Open Your browser and type http://localhost:8080 . Step 4: Save your app inside the root folder in apache . Step 5: Type http://localhost:8080/<appname.jsp> to run you 9
  10. 10. Time For Some Coding <%@page contentType="text/html" import="java.util.*" %> 1st JSP tag<html><body><p>&nbsp;</p><div align="center"><center><table border="0" cellpadding="0" cellspacing="0" width="460"bgcolor="#EEFFCA"><tr><td width="100%"><font size="6" color="#008000">&nbsp;DateExample</font></td></tr><tr><td width="100%"><b>&nbsp;Current Date and time is:&nbsp; <fontcolor="#FF0000"><%= new java.util.Date() %> 2nd JSP tag</font></b></td></tr></table></center></div></body></html> 10
  11. 11. Another ExampleCreate a simple HTML page having the followingoutput :Select Your Sport : CricketBasketball SoccerRugbyHockey 11
  12. 12. JSP Coding Part• <html> <body> <%! String[] sports; %> <center>You have selected: <% sports = request.getParameterValues("sports"); if (sports != null) { for (int i = 0; i < sports.length; i++) { out.println ("<b>"+sports[i]+"<b>"); } } else out.println ("<b>none<b>"); %> </center> </body> </html> 12
  13. 13. The OutputYou have selected: CricketSoccer 13
  14. 14. That Was Easy ..• So with the help of some simple examples we saw the Power of JSP.One can make JSP work the way he/shewants and develop a full fledged web appwith it .. So , CODE & DESIGN ..The world is all yours.. 14
  15. 15. Thank You Presented By :- Apoorv Anand @APo_ORV 15

×