Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jsp (Java Server Page) Is a server side program.

Similar presentations


Presentation on theme: "Jsp (Java Server Page) Is a server side program."— Presentation transcript:

1 Jsp (Java Server Page) Is a server side program.
Is called by client to provide a web service. Jsp is written in HTML rather than with the java programming languge jspInt() - provides customized functionality when the jsp is called jspDestroy() - provides customized functionality when the jsp is destroyed Service – is automatically called & retrieves a connection to HTTP.

2 JSP Tags Consists of combination of HTML tags & jsp tags.
Jsp tags define java code that is to be executed before the output of the jsp program is sent to the browser. Tags begins with a <% …… %> Extended Markup Language(XML) version of jsp tags <jsp:TagID>……</jsp:TagID>

3 Processed by JSP Virtual machine. (TOMCAT)
Tomcat reads the jsp program whenever the program is called by a browser & sends the HTML tags , related information to the browser.

4 JSP Tags Comment tags : <% …….. %>
Declaration tags : <%! …….. %> Directive tags : ……… %> page import = import java.sql.*;%> Expression tags : <%= ……….. %> Scriptlet TAGS : controls & loops <% %>

5 Variables & Objects <html> <head>
<title> jsp </title> </head> <body> <%! int age= 24;%> <p> Your age is : <%=age%> </body> </html>

6 Methods <html> <head>
<title> jsp - methods</title> </head> <body> <%! int curve (int g) { return(10+g); } int curve1 (int a,int b) return(a+b); %> <p>Result : <%=curve(20)%> <p>Result1: <%=curve1(1,2)%> </body> </html>

7 Control Statement <html> <head>
<title> jsp - control</title> </head> <body> <%! int g=60;%> <% if(g>=70) { %> <p> FIRST GRADE <% } else { %> <p> SECOND GRADE</p> <%}%> </body> </html>

8 TOMCAT Jsp program executed by a JSP Virtual machine.
Tomcat is a JSP Virtual machine.

9 Request String The browser generates a user request whenever the submit button is selected. String s= request.getParameter(fname); String h[]= request.getParameterValues(hobbies); Is used to parse a value of a specified value Four predefined implicit object request response session out – is an instance of the jspWriter that is used to send a response to the client.

10 Parsing Other Information
The requested string send to the jsp by the browser is divided into two general components that are separated by the question mark. Left – url components Right – query string Methos used to parse URL information Protocol – http, https, ftp Host(ip address) Port Physical path


Download ppt "Jsp (Java Server Page) Is a server side program."

Similar presentations


Ads by Google