Results 1 to 3 of 3

Thread: What is JavaServer Pages?

  1. #1
    Join Date
    May 2008
    Posts
    143

    What is JavaServer Pages?

    JavaServer Pages (JSP) is a Java technology that allows software developers to dynamically generate HTML, XML or other types of documents. This technology allows the code and certain pre-defined actions to be incorporated into the static content.

    The JavaServer Pages or JSP is a Java-based technology that allows developers to dynamically generate HTML, XML or any other type of web page. The technology allows Java code and certain pre-defined actions to be added in a static content. Since version 2.0 specification, the syntax is completely JSP XML. The JSP syntax adds other XML-like tags, called JSP actions, which are used to invoke functionality. The technology also allows for creation of JSP libraries that act as extensions to the language standard HTML or XML. Or tags (metadata) provide a platform independent way to extend (expand) the capabilities of a Web server.

    The JSP syntax adds XML tags, called JSP actions, which may be used for calling functions. Moreover, the technology allows the creation of JSP tag library (taglib) that act as extensions to HTML or XML. The tag libraries provide a method independent of the platform to extend the functionality of a HTTP server.

    JSP is compiled into Java Servlets by a JSP compiler. A JSP compiler may generate a servlet in Java code (Java) which is then compiled by the Java compiler. A servlet is a Java application that allows you to dynamically create data in an HTTP server. These data are generally presented in HTML format, but may also be in XML format or another format for web browsers. Servlets use the Java Servlet API..

    JSP is compiled by a JSP compiler into Java servlets. A JSP compiler may generate a servlet in Java Java source code which can then be compiled by the Java compiler, or may generate the pseudo-Java code directly interpretable. In both cases, it is useful to understand how the JSP compiler transforms the page in Java servlet. See the example JSP provided at the end of the article, with the servlet generated and the resulting HTML page.

    In addition to actions JSP pre-defined, developers can add their own custom actions using the API extending JSP tags (JSP Tag Extension API). To do this, you need to write a Java class that implements an interface markup and writing the XML description tag that gives the characteristics of the marker and the classes that implement it.

  2. #2
    Join Date
    May 2008
    Posts
    143

    Re: What is JavaServer Pages?

    JSP Technology in the Java EE 5 Platform

    The focus of Java EE 5 has been ease of development by making use of Java language annotations that were introduced by J2SE 5.0. JSP 2.1 supports this goal by defining annotations for dependency injection on JSP tag handlers and context listeners.

    Another key concern of the Java EE 5 specification has been the alignment of its webtier technologies, namely JavaServer Pages (JSP), JavaServer Faces (JSF), and JavaServer Pages Standard Tag Library (JSTL).

    The outcome of this alignment effort has been the Unified Expression Language (EL), which integrates the expression languages defined by JSP 2.0 and JSF 1.1.

    he main key additions to the Unified EL that came out of tbe alignment work have been:

    • A pluggable API for resolving variable references into Java objects and for resolving the properties applied to these Java objects,
    • Support for deferred expressions, which may be evaluated by a tag handler when needed, unlike their regular expression counterparts, which get evaluated immediately when a page is executed and rendered, and
    • Support for lvalue expression, which appear on the left hand side of an assignment operation. When used as an lvalue, an EL expression represents a reference to a data structure, for example: a JavaBeans property, that is assigned some user input.


    The new Unified EL is defined in its own specification document, which is delivered along with the JSP 2.1 specification.

  3. #3
    Join Date
    May 2008
    Posts
    143

    Re: What is JavaServer Pages?

    It is helpful to understand how the JSP compiler transforms the page into a Java servlet. For example, consider the following input JSP and its resulting generated Java Servlet.

    Input JSP

    Code:
    <%@ page errorPage="myerror.jsp" %>
     <%@ page import="com.foo.bar" %>
     
     <html>
     <head>
     <%! int serverInstanceVariable = 1;%>
     
     <% int localStackBasedVariable = 1; %>
     <table>
     <tr><td><%= toStringOrBlank( "expanded inline data " + 1 ) %></td></tr>
    Resulting servlet

    Code:
    package jsp_servlet;
     import java.util.*;
     import java.io.*;
     import javax.servlet.*;
     import javax.servlet.http.*;
     import javax.servlet.jsp.*;
     import javax.servlet.jsp.tagext.*;
     
     import com.foo.bar; // Imported as a result of <%@ page import="com.foo.bar" %>
     import …
     
     class _myservlet implements javax.servlet.Servlet, javax.servlet.jsp.HttpJspPage {
        // Inserted as a
        // result of <%! int serverInstanceVariable = 1;%>
        int serverInstanceVariable = 1;
        …
     
        public void _jspService( javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response )
        throws javax.servlet.ServletException,
        java.io.IOException
        {
            javax.servlet.ServletConfig config = …; // Get the servlet config
            Object page = this;
            PageContext pageContext = …;            // Get the page context for this request
            javax.servlet.jsp.JspWriter out = pageContext.getOut();
            HttpSession session = request.getSession( true );
            try {
                out.print( "<html>\r\n" );
                out.print( "<head>\r\n" );
                …
                // From <% int localStackBasedVariable = 1; %>
                int localStackBasedVariable = 1;
                …
                out.print( "<table>\r\n" );
                out.print( " <tr><td>" );
                // From <%= toStringOrBlank( "expanded inline data " + 1 ) %>
                out.print( toStringOrBlank( "expanded inline data " + 1 ) );
                out.print( " </td></tr>\r\n" );
                …
            } catch ( Exception _exception ) {
                // Clean up and redirect to error page in <%@ page errorPage="myerror.jsp" %>
            }
        }
     }

Similar Threads

  1. How to merge odd and even pages
    By Fausty in forum Windows Software
    Replies: 6
    Last Post: 19-07-2010, 09:26 AM
  2. Columns in Pages
    By Feng in forum Windows Software
    Replies: 6
    Last Post: 01-06-2010, 06:45 AM
  3. How to link web pages?
    By ProfilerJI in forum Software Development
    Replies: 4
    Last Post: 15-01-2010, 06:11 PM
  4. How do i add pages to existing pages in iweb
    By Samsher in forum Software Development
    Replies: 3
    Last Post: 04-05-2009, 10:18 AM
  5. Cannot print from web pages
    By RonaldA in forum Technology & Internet
    Replies: 3
    Last Post: 09-03-2009, 06:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,570,293.51974 seconds with 17 queries