Turn Desktop View Off
by Dinesh Thakur

When the bill amount exceeds Rs. 1000 then else part of calc.jsp gets executed and it forwards the request to discount.jsp page .

 
by Dinesh Thakur

Standard syntax

<j sp: forward page= "desturl" />

 
by Dinesh Thakur

Standard syntax

<% @ include file= "desturl" %>

 
by Dinesh Thakur

The intention is to introduce the communication in between the servlet and JSP. The welcome page is designed by the HTML code.



 
by Dinesh Thakur

In the below JSP program the aim is to understand how JSP communicates with the database. The designing is done by HTML.

 
by Dinesh Thakur

When we send any request to the JSP program from the browser window, we pass the request URL in the browser window. In this process to send the data along with the request, the programmer also requires adding the query string to request URL explicitly. But this task is highly of technical. For that a graphical user interface is required which can generate a request which mayor may not hold the data. For this purpose, the programmer can use either HTML form or hyperlink to generate the request with or without data. The example of HTML to JSP communication is given below:

 
by Dinesh Thakur

In this Example we will discuss about how to read text file with the JSP objects. First we create a text file that contains strings in it. In the program we use input and output stream for execute the expression.

 
by Dinesh Thakur

             This Example is use to get the Information about Server’s Information. Like port number, server name.

 
by Dinesh Thakur

In this example we will define that about page counter every time a user visit the page will be counted. In this we made a program where i static click variable initialize and the value declare 0. If any user visit site any tym it will display the visit number. With help of for loop it will increase the visits one by one.

 
by Dinesh Thakur

Jsp expressions known as those kind of expressions that are containing the scripting language values. To Display the expression value we create a HTML tags page that will use to fill the required fields that will be displayed according to need.

 
by Dinesh Thakur

We know servlet program is placed in WEB-INF folder. WEB-INF is a private directory of deployed web application. So any web resource program that is placed in WEB-INF folder or its subfolder (like classes) must be configured in web.xml file to make the underlying container and server recognizing web resource program.



 
by Dinesh Thakur

A JSP program can have two types of objects.

• Explicit objects

• Implicit objects

 
by Dinesh Thakur

JSP comment

Used for commenting JSP tags base code (or JSP code) of JSP program. A JSP page compiler recognizes JSP comments. As JSP comments are visible in source, code of  JSP program and not visible in any other process of JSP program execution so these are called hidden comments. They are written like this:

 
by Dinesh Thakur

A JSP page contains tags. The tags are in the form of scripting tags, directive tags and comments. Tags help programmers to develop Java codeless JSP program. Implicit objects increase the functionality of JSP page. Scripting element also helps in generating dynamic content and displaying dynamic content.



 
by Dinesh Thakur

Life cycle of a program includes the phases starting from creating objects for the class, execution, and at last destruction of objects. For this life cycle, JSP needs some life cycle methods.

 
by Dinesh Thakur

A JSP page mainly comprises the following types of code.

 
by Dinesh Thakur

For web application development JSP generally supports two types of architecture.

 
by Dinesh Thakur

Supports tags based programming

JSP supports tag-based programming. As it is a tag-based programming extensive knowledge of Java is not required. Non-Java users can learn it easily. This tag increases the readability of code. Gives built-in JSP tags and also allows to develop custom JSP tags and also to use third party supplied JSP tags.



 
by Dinesh Thakur

We know that Servlet is a server side technology, so why has Sun Microsystems given JSP?



 
by Dinesh Thakur

There are some problems with Servlet programming.



 
by Dinesh Thakur

JSP technology is the Java Platform Technology (enterprise technology) for delivering dynamic content to web user (the person who is giving request from browser window) in a portable, secure and well-defined way. JSP has been built on top of the Servlet API and utilizes Servlet semantics. It uses HTML and XML templates and Java code to generate JSP page. JSP is secure, fast and independent of server platforms.