Home Jsp Introduction to the JSP Java Server Pages
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Introduction to the JSP Java Server Pages

Advertisement
Introduction to the JSP Java Server Pages Welcome to JSP Section Introduction To JSP Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide excellent server side scripting support for creating database

JSP Tutorials

     

JSP Tutorials and examples, you will find many examples with working source code.

  1. Introduction to JSP
    Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide excellent server side scripting support for creating database driven web applications.
     
  2. JSP Tutorials - Introducing Java Server Pages Technology
    JavaServer Pages (JSP) technology is the Java platform technology for delivering dynamic content to web clients in a portable, secure and well-defined way.
      
  3. JSP Architecture
    JPS pages are high level extension of servlet and it enable the developers to embed java code in html pages. JSP files are finally compiled into a servlet by the JSP engine. Compiled servlet is used by the engine to serve the requests.
     
  4. Introduction to the JSP tags(This section also describe JSP Directives)
    In this lesson we will learn about the various tags available in JSP with suitable examples. In JSP tags can be devided into 4 different types.
      
  5. Detail introduction to JSP Declaratives
    JSP Declaratives begins with <%! and ends %> with .We can embed any amount of java code in the JSP Declaratives. Variables and functions defined in the declaratives are class level and can be used anywhere in the JSP page.
      
  6. Detail Introduction to JSP Scriptlets and JSP Expressions with examples
    JSP Scriptlets begins with <% and ends %> .We can embed any amount of java code in the JSP Scriptlets. JSP Engine places these code in the _jspService() method.
     
  7. Writing the Date JSP
    Till now you learned about the JSP syntax, now I will show you how to create a simple dynamic JSP page that prints the current date and time.
      
  8. Reading the Request Information
    When an HTTP client such as web browser sends a request to a wen server, along with the request it also sends some HTTP variables like Remote address, Remote host, Content type etc.
     
  9. Retrieving the data posted to a JSP file from HTML file
    Now I will show you how to retrieve the data posted from a HTML file in a JSP page. Consider an html page that prompts the user to enter his/her name, let's call it getname.htm.
      
  10. Accessing database fro JSP
    In This article I am going to mdiscuss the connectivity from MYSQL database with JSP.we take a example of Books database. This database contains a table named books_details.
     
  11. Working with JSP Sessions
    This JSP Tutorial shows you how to track the session between different JSP pages. In any web application user moves from one page to another and it becomes necessary to track the user data and objects throughout the application. JSP provide an implicit object "session", which can be use to save the data specific the particular to the user.
      
  12. JSP Cookies Example
    This tutorial shows how to handle cookies in JSP pages. In this tutorial you will learn how to add cookies through jsp page and then show the value of the same cookie in another JSP page.
     
  13. Disabling Session in JSP
    In this tutorial you will learn how to disable session creation in the JSP pages. Disabling the session in some pages will improve the performance of your JSP container.
      
  14. JSP PDF books
    Collection is jsp books in the pdf format. You can download these books and study it offline.
      
  15. Free JSP Books
    Download the following JSP books.
      
  16. Free JSP Download
    Books
    Free JSP Books for instant downloads.
      
JSP 2.0
    1. New Features in JSP 2.0
       
JSTL Tutorial By R.S.RAMASWAMY.
Comments on this article may be sent to: ramrsr@rediffmail.com
    1. INTRODUCTION TO JSTL
       
    2. JSTL tags in the core-group
       
    3. JSTL XML Tags
       
    4. SQL tags in JSTL
       
 

JSP Fundamentals
This is an excellent tutorial on JSP for the beginners. Tutorial describes how to use Bean in JSP, Connection Pooling in JSP and the use of taglibs. 

    • JSP Fundamentals
      JSP termed as Java Server Pages is a technology introduced by Sun Microsystems Inc. to develop the web application in more efficient way than Servlets. It has got many advanced features than servlets, one of them itself define the JSP i.e. JSP separates the presentation logic from the business logic and provide the designer and developer of the web application to work independently without any hassle.
       
    • Using Beans in JSP
      Java Beans are reusable components. They are used to separate Business logic from the Presentation logic. Internally, a bean is just an instance of a class.
         
    • JSP Taglibraries
      JSP?s offer a unique feature of ?Tag Libraries?. Simply put, these are custom defined JSP tags. They are basically meant for componentizing presentation level logic. They are very similar to beans except the fact that Beans are used to separate Business logic.

 

JSP Examples

  1. Calculate a factorial by using while loop
    In this example we are going to find out the factorial of 12 by using the while loop. In while loop the loop will run until the condition we have given gets true.
     
  2. Calculate factorial
    After going through this example you will be understand how you can calculate the factorial by using recursion in jsp. To make a program on factorial, firstly it must be clear what is recursion.
      
  3. Celsius to Fahrenheit
    Celsius is a unit to measure temperature scale on which water freezes at 0 degree and boiling point is 100 degree. This unit is discovered by Celsius in 1742, a Swedish astronomer and physicist, he has invented the centigrade, or Celsius thermometer divided between the freezing and boiling points of water into 100 parts.
      
  4. Comment
    In a jsp we should always try to use jsp- style comments unless you want the comments to appear in the HTML. Jsp comments are converted by the jsp engine into java comments in the source code of the servlet that implements the Jsp page.
      
  5. Html tag inside out implicit object
    In this program we are going to use a html tag inside a out object. out object is used to display the content on the browser. To make this program run use out object inside which define some html code along with the content you want to display on the browser
      
  6. Jsp methods
    In this example  we are going to show you how we can declare a method and how we can used it. In this example we are making a method named as addNum(int i, int b) which will take two numbers as its parameters and return integer value.
      
  7. multiple method
    Jsp is used mainly for presentation logic. In the jsp we can declare methods just like as we declare methods in java classes. Methods can be declared in either declaration directive or we can declare it in scriptlet. If we declare method inside declaration directive, then the method is applicable in the whole page.
     
  8. Passing Array method
    Array is a collection of similar data type. It is one of  the simplest data structures. Arrays holds equally sized data elements generally of the similar data type.
      
  9. Two index 
    In this example we will show how we can use two indexes in a for loop. We can solve this problem by using for loop defined inside the scriptlet directive.
      
  10. Celsius To Fahrenheit
    In this example you will learn how to convert the temperature Celsius to Fahrenheit. To change the Celsius to Fahrenheit we have the formula Fahrenheit = 32 + 9*c/5.
      
  11. JSP Methods
    In this example we are going to show you how we can declare a method and how we can used it. In this example we are making a method named as addNum(int i, int b) which will take two numbers as its parameters and return integer value.
     
  12. Multiple Methods
    Jsp is used mainly for presentation logic. In the jsp we can declare methods just like as we declare methods in java classes. Methods can be declared in either declaration directive or we can declare it in scriptlet.
      
  13. Hello World JSP Page
    By this example we are going to teach you that how can you write a "hello world" on your browser. Jsp can be learned very easily. This is just the beginning to learn this exciting language.
     
     
  14. The Page Directive in JSP Page
    This section illustrates you about the page directive of the JSP page which works for the entire JSP page. These directives apply different properties for the page like language support, page information and import etc.
      
  15. The extends Attribute of page Directive In JSP
     
  16. The import Attribute of page Directive In JSP
    This section shows you how to import a java package or the class in your jsp application.
     
  17. The session Attribute of page Directive In JSP
    This section provides you the best illustration of the session attribute of the page directive in JSP. This is the boolean attribute of the directive. It sets a boolean value either true or false.
      
  18. The buffer Attribute of page Directive In JSP
    This section just introduces about the buffer attribute of the page directive in JSP. This attribute sets the buffer size in kilobytes i.e. used by the out object to handle output generated by the JSP page on the client web browser.
      
  19. The autoFlush Attribute of page Directive In JSP
    This section illustrates you about the autoFlush attribute of the page directive in JSP. This is an boolean attribute. This attribute of the page directive supports for flushing buffer automatically when the buffer is full.
      
  20. The isThreadSafe Attribute of page Directive In JSP
    In this section, you will learn about a type of the attribute of the page directive in JSP as known as isThreadSafe attribute.
        
  21. The info Attribute of page Directive In JSP
    This section gives you the introduction about the info attribute of the page directive in JSP. This attribute simply sets the information of the JSP page which is retrieved later by using Servlet.getServletInfo() method.
     
  22. The errorPage Attribute of page Directive In JSP
    This section illustrates you about the errorPage attribute of the page directive in JSP. This attribute sets a url (relative path starting from the "/" which refers from the root directory of your JSP application).
     
  23. The contentType Attribute of page Directive In JSP
    This section gives you the best illustration about the contentType attribute of the page directive in JSP. This attribute specifies the MIME type and the character encoding i.e. used for the JSP response.
      
  24. The isErrorPage Attribute of page Directive In JSP
    This section provides the best illustration of the isErrorPage attribute of the page directive in JSP by providing three JSP pages and it's output. This is a boolean attribute of the page directive.
     
  25. The pageEncoding Attribute of page Directive In JSP
    This section provides the best illustration about the pageEncoding attribute of the page directive in JSP. This attribute specifies the language that the page uses when the page is sent to the browser. This attribute works like the meta tag of the HTML markup language.
     
  26. The isELIgnored Attribute of page Directive In JSP
      
  27. The Include Directive in JSP Page
    This section illustrates you about the include directive of the JSP. You will learn about what is include and how to implement it in the JSP page.
     
  28. How to create a form in JSP
    This section illustrates you about the procedure of the creation of a form through the HTML code in the JSP page. You can simply use the <form></form> tags for creating a from and save the file with the ".jsp" extension.
      
  29. How to handle a form in JSP
    This section teaches you about the creating a from and the procedure of handling the form through the JSP code. This section provides JSP code which used the HTML code for creating a form and this form is handled by the JSP code.
     
  30. Get Method of the Form In JSP
    This section provides you the best illustration of the get method of the form in JSP. The HTTP get method sends data to the server.
      
  31. Post Method of the Form In JSP
    This section provides you the best illustration of the post method of the form in JSP. The HTTP post method sends data to the server from the HTML form elements.
     
  32. What Is Tag Libray In JSP?
    This section provides you the detailed explanation of the Tag Library in JSP. In the Java Server Pages Technology, multiple actions are accessed by using the tags of the JSP whether the tag is standard tag of the JSP or the custom tag that is made by you.
     
  33. Declaring Tag Library In JSP 
    Tag libraries are declared by using the <%@taglib %> directive of the JSP. This tag has some own attributes and it's values are specified attributes specifically of the taglib directive.
      
  34. Request Object In JSP
    This section illustrates more about the JSP implicit object called Request object. This object retrieves values whatever client passes to the server by an HTTP request.
      
  35. getParameter() Method Of The Request Object
    This section illustrates you about the getParameter() method of the request object. This section provides you the best illustration for why the method used or how to use in your JSP application.
      
  36. getParameterNames() Method Of The Request Object
    This section gives you the detailed explanation about the getParameterNames() method of the request object. You will learn more about the procedure of using the getParameterNames() method of the request object.
      
  37. getParameterValues() Method Of The Request Object
    This section illustrates you about the getParameterValues() method of the request object. Here, you will learn more about the getParameterValues() method like what's the need of using the method in your JSP application.
      
  38. getCookies() Method Of The Request Object
      
  39. getQueryString() Method Of The Request Object
    This section describes the getQueryString() method of the request object. Here, you will learn more about the getQueryString() method of the request like what's the need of the method and how to implement it into your JSP application code.
      
  40. getRequestURI() Method Of The Request Object
      
  41. getHeaderNames() Method Of The Request Object
      
  42. getHeader() Method Of The Request Object
     
  43. getAttribute() Method Of The Request Object
      
  44. getAttributeNames() Method Of The Request Object
      
  45. setAttribute() Method Of The Request Object
      
  46. removeAttribute() Method Of The Request Object
      
  47. Response Object In JSP
      
  48.  

Many JSP Tutorials
Collection of a large number of JSP Tutorials

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 30, 2005

Related Tutorials

Ask Questions?    Discuss: Introduction to the JSP Java Server Pages   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Sheeyla Marrero
April 18, 2011
Duplicates on a JSP webpageHi

Hi There.. I am building a JSP web application in which I need to write data into MySQL database, but I need a code to check if data entered has not been entered before, to avoid duplicates.... This is what I have so far, but it is not working, it is writing data into the database even when I am intentionally using data already in the database.... <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <html> <head><title>Create Data</title></head> <body bgcolor=#F5F5F5> <%-- <jsp:useBean id="beanInstanceName" scope="session" class="beanPackage.BeanClassName"/> --%> <%-- <jsp:getProperty name="beanInstanceName" property="propertyName"/> --%> <%@page import="java.sql.*"%> <% String REF=request.getParameter("d_ref"); String DATE=request.getParameter("i_date"); String UBC=request.getParameter("i_ubc"); %> <% try { //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Connection connection=DriverManager.getConnection("jdbc:odbc:db1","",""); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection=DriverManager.getConnection("jdbc:mysql://localhost/labacacias?user=root&password=letmein"); Statement statement=connection.createStatement(); String query; query="SELECT referencia FROM enero"; boolean b=false; ResultSet resultSet=statement.executeQuery(query); while (resultSet.next()) { if (REF.compareTo(resultSet.getString(1))==0) { b=true; } if (b) { out.println("Datos ya han sido adjuntados anteriormente!"); out.println("<a href=\"EneroU.jsp\">Click Aqui para Adjuntar nuevos Resultados</a>"); } else { pageContext.forward("InsertE.jsp"); } } } catch (Exception e) { //e.printStackTrace(); out.println(e.toString()); } %> </body> </html> Could you please help????
Sheeyla Marrero
April 18, 2011
Duplicates on a JSP webpageHi

Hi There.. I am building a JSP web application in which I need to write data into MySQL database, but I need a code to check if data entered has not been entered before, to avoid duplicates.... This is what I have so far, but it is not working, it is writing data into the database even when I am intentionally using data already in the database.... <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <html> <head><title>Create Data</title></head> <body bgcolor=#F5F5F5> <%-- <jsp:useBean id="beanInstanceName" scope="session" class="beanPackage.BeanClassName"/> --%> <%-- <jsp:getProperty name="beanInstanceName" property="propertyName"/> --%> <%@page import="java.sql.*"%> <% String REF=request.getParameter("d_ref"); String DATE=request.getParameter("i_date"); String UBC=request.getParameter("i_ubc"); %> <% try { //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Connection connection=DriverManager.getConnection("jdbc:odbc:db1","",""); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection=DriverManager.getConnection("jdbc:mysql://localhost/labacacias?user=root&password=letmein"); Statement statement=connection.createStatement(); String query; query="SELECT referencia FROM enero"; boolean b=false; ResultSet resultSet=statement.executeQuery(query); while (resultSet.next()) { if (REF.compareTo(resultSet.getString(1))==0) { b=true; } if (b) { out.println("Datos ya han sido adjuntados anteriormente!"); out.println("<a href=\"EneroU.jsp\">Click Aqui para Adjuntar nuevos Resultados</a>"); } else { pageContext.forward("InsertE.jsp"); } } } catch (Exception e) { //e.printStackTrace(); out.println(e.toString()); } %> </body> </html> Could you please help????
karthik
June 16, 2011
student

no comments
Anseri
November 11, 2012
Java

this service is good.
DMCA.com