Presentation is loading. Please wait.

Presentation is loading. Please wait.

STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH (120101240) SOMYA SHRIVASTAV (120101244) SONAM JINDAL (120101246)

Similar presentations


Presentation on theme: "STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH (120101240) SOMYA SHRIVASTAV (120101244) SONAM JINDAL (120101246)"— Presentation transcript:

1 STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH (120101240) SOMYA SHRIVASTAV (120101244) SONAM JINDAL (120101246)

2 What is JSP?  JSP stands for Java Server Pages. JSP have.jsp extension.  JSP technology is used to create dynamic web application same like Servlet technology.  It is another web technology given by Sun Microsystem for the development of dynamic web pages on the client browser.  A JSP page consists of Html tags and JSP tags. The jsp pages are easier to maintain than servlet. It provides some additional features such as Expression Language, Custom Tag etc.  A JSP is called as page but not program because a JSP contains totally tags. Every JSP is internally converted into a Servlet by the server container.  A JSP page contains both html tags and JSP tags. Html tags will produce static output and JSP tags will produced dynamic output. Because of JSP tags we called as JSP is dynamic web page

3 Java Server Page A JSP contains a mix of HTML and Java code where the Java code handles all the page logic and the HTML manages the display. When the JSP container receives the first request for a Java Server Page it is required to convert the JSP into a Java Servlet. This Servlet is then executed and the output of this execution is sent as the response to the initial request. <% java.util.Date dateToday = new java.util.Date(); %> Todays date is Java Code, when executed, assigns the variable dateToday the current system date. HTML Code, the value of dateToday is written to the HTML in the line Todays date is

4 Directory structure of JSP Because of jsp page contains outside of WEB-INF, JSP is a public file to the web application. You can directly access these JSP pages from client system browser window. When requested the JSP Container converts a JSP is to a Servlet The JSP Container uses the JDK to compile the Servlet The JSP Container executes the compiled Servlet in the JVM

5 JSP Example Hello word JSP program must be save with the.jsp extension.

6 How to run jsp program  Deploy jsp code in root directory  Start Server  Visit on browser or give request with url like below http://localhost:portnumber/RootDirectory/jspfile

7 Scripting Element In JSP, java code can be written inside the jsp page using the scriptlet tag. JSP Scripting element are written inside tags. These code inside tags are processed by the JSP engine during translation of the JSP page. Scripting ElementExample Comment Directive Declaration Scriptlet Expression

8 Scripting Element  JSP Comment  My First JSP Page <% int count = 0; %> Page Count is

9 Scripting Element  Directive Tag  or

10 Scripting Element  Declaration Tag  My First JSP Page <%! int count = 0; %> Page Count is:

11 Scripting Element  Scriptlet Tag  My First JSP Page <% int count = 0; %> Page Count is

12 Scripting Element  Expression Tag  html> My First JSP Page <% int count = 0; %> Page Count is


Download ppt "STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH (120101240) SOMYA SHRIVASTAV (120101244) SONAM JINDAL (120101246)"

Similar presentations


Ads by Google