1 / 10

Introduction to JSP

Introduction to JSP. Yingcai Xiao. JSP. JavaServer Page Server side programming language Java imbedded in HTML Compiled Object-oriented Similar to ASP.NET Dynamically generates web pages. JSP Example. <html> <head> <title> Get a Celsius temperature </title> </head> <body>

nupchurch
Télécharger la présentation

Introduction to JSP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to JSP Yingcai Xiao

  2. JSP • JavaServer Page • Server side programming language • Java imbedded in HTML • Compiled • Object-oriented • Similar to ASP.NET • Dynamically generates web pages .

  3. JSP Example <html> <head> <title> Get a Celsius temperature </title> </head> <body> <!-- Display a form to collect a Celsius temperature --> <form action = "tempconvert0.jsp" method = "get" > Celsius temperature: <input type = "text" name = "ctemp" /> <input type = "submit" /> </form> </body> </html> .

  4. JSP Example <html> <head> <title> Temperature converter </title> </head> <body> <% // Get the Celsius temperature from the form String strCtemp = request.getParameter("ctemp"); float ftemp; // convert the value to Fahrenheit ftemp = 1.8f * Integer.parseInt(strCtemp) + 32.0f; %> <!-- Use an expression to display the value of the Fahrenheit temperature --> Fahrenheit temperature: <%= ftemp %> </body> </html> .

  5. JSP Programming • Three ways of imbedding code in HTML: external, document, inline. • Imbedding tags: CSS: <style></style> JS: <script></script> PHP: <?php?> JSP: <%> .

  6. JSP Programming • 5 steps of Web-based server-side computation: • Get input as text from client. • Convert text to numbers. • Compute. • Convert numbers to text. • Sent output to client • In the example, step 4 is done automatically by type conversion. • Step 5 is just “=“. .

  7. JSP References • https://en.wikipedia.org/wiki/JavaServer_Pages • http://www.oracle.com/technetwork/java/javaee/jsp/index.html • http://docs.oracle.com/javaee/5/tutorial/doc/bnagx.html • https://www.tutorialspoint.com/jsp/ .

  8. JSP Interview Questions • https://www.tutorialspoint.com/questions_and_answers.htm .

  9. JSP vs Servlet • Java Servlets are server side Java programs. • Pure java code, not embedded. • Object oriented • Compiled • Runs faster than JSP • JSP usually used to created UI. • Servlets usually are used to create backend code. .

  10. JDBC • Java Database Connectivity • https://en.wikipedia.org/wiki/Java_Database_Connectivity • http://www.oracle.com/technetwork/java/javase/jdbc/index.html • https://docs.oracle.com/javase/tutorial/jdbc/basics/

More Related