Professional Documents
Culture Documents
Java EE - Presentation
Java EE - Presentation
Java EE - Presentation
JAVAEE PRESENTATION
Index
1. Introduction to Advance Java 6. Http Session
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Index
1. Error Handling with Try-Catch block 1. JSTL
a) JSTL Core Tags
2. JSP Action Tags
b) JSTL Function Tags
a) jsp:forward
c) JSTL Formatting Tags
b) jsp:include
d) JSTL SQL Tags
c) jsp:useBean
3. jsp:ExpressionLanguage
a) El param
b) EL Session
c) El Cookies
4. Precedence of Operations in EL
5. Reserve words in EL
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Introduction
The APIs defined in Java Enterprise Edition, includes Servlet programming, Web Services,
the Persistence API, etc.
It is a Web & Enterprise application development platform which basically follows client &
server architecture.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Introduction
Advance Java i.e. JEE (Java Enterprise Edition) gives you the library to understand the
Client-Server architecture for Web Application Development which Core Java doesn’t
support.
J2EE is platform Independent, Java Centric environment for developing, building &
deploying Web-based applications online. It also consists of a set of services, APIs, and
protocols, which provides the functionality that is necessary for developing multi-tiered,
web-based applications.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Introduction
There are a lot of Advance Java frameworks like Spring, JSF, Struts etc. which enable you
to develop a secure transaction based web apps for the domains like E-Commerce,
Banking, Legal, Financial, Healthcare, Inventory etc.
To work and understand the hot technologies like Hadoop and Cloud services, you should
be prepared with core and advanced Java concepts
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Introduction
The documents are formatted using a markup language called HTML (HyperText Markup
Language) that supports links to other documents like graphics, audio, and video files etc.
So, a website is a collection of static files i.e. web pages like HTML pages, images, graphics
etc.
The Web application is a website with dynamic functionality on the server. Google,
Facebook, Twitter are examples of web applications.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Introduction
With HTTP the clients connect to the server to send one request and then disconnect.
And this mechanism allows more users to connect to a given server over a period of time.
Here, the client sends an HTTP request and the server answers with an HTML page to the
client, using HTTP.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Introduction to Servlet
Introduction to Servlet:
A servlet is a Java programming language class that is used to extend the capabilities of
servers that host applications accessed by means of a request-response programming
model. The Servlet interface is the root interface of the servlet class hierarchy. All
Servlets need to either directly or indirectly implement the Servlet interface.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Introduction to Servlet
Introduction to Servlet:
• It is also a class that extends the capabilities of the servers and responds to the
incoming requests. It can respond to any requests.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Servlet Lifecycle
The entire life cycle of a Servlet is managed by the Servlet container which uses the
javax.servlet.Servlet interface to understand the Servlet object and manage it.
Stages of the Servlet Life Cycle: The Servlet life cycle mainly goes through four stages,
• Instantiating a Servlet.
• Initializing the Servlet.
• Request handling
• Destroying the Servlet.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Steps to create Servlet
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Steps to create Servlet
Once the server is configured, you can start with your program.
One important point to note – for any servlet program, you need 3 files – index.html file,
Java class file, and web.xml file.
Though index.html is not mandatory. And web.xml can also be replaced by using
annotations. Here we will consider the generic structure of the project.
The very first step is to create a Dynamic Web Project and then proceed further.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet in Eclipse
Servlet in Eclipse:
Click on New
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet in Eclipse
Servlet in Eclipse:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Client-side Data Processing with Servlet
Now, based on the above steps let’s write a program and understand how servlet works.
• Step 1: To run a servlet program, we should have Apache tomcat server installed and
configured. Once the server is configured, you can start with your program.
• Step 2: For a servlet program, you need 3 files – index.html file, Java class file, and
web.xml file. The very first step is to create Dynamic Web Project and then proceed
further.
• Step 3: Now let’s see how to add 2 numbers using servlets and display the output in
the browser.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Client-side Data Processing with Servlet
Step 4: Now without the Java class file, you can’t perform addition on 2 numbers. So let’s
write a class file.
Above program creates a form to enter the numbers for the addition operation.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Client-side Data Processing with
Servlet
Processing the client-side data through servlet:
Step 4: Now without the Java class file, you can’t perform addition on 2 numbers. So let’s
write a class file.
Step 5: After writing the Java class file, the last step is to add mappings to the web.xml
file. Let’s see how to do that.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Client-side Data Processing with
Servlet
Processing the client-side data through servlet:
Step 6: web.xml file will be present in the WEB-INF folder of your web content. If it is not
present, then you can click on Deployment Descriptor and click on Generate Deployment
Descriptor Stub.
Step 7: After that, you can proceed further and add the mappings to it.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Client-side Data Processing with
Servlet
Processing the client-side data through servlet:
Step 8: Run the program and enter two values you want to add.
Step 9: Fill up the form, click the submit button to trigger the servlet.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Welcome-file-list
Welcome-file-list
Its sub element is welcome-file that is used to define the welcome file.
A welcome file is the file that is invoked automatically by the server, if you don't specify
any file name.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Java EE: Welcome-file-list
Welcome-file-list
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Request
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Request
Index.html
Output:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Request
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Request Dispatcher
Request Dispatcher
This interface can also be used to include the content of another resource also. It is one of
the way of servlet collaboration.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Request Dispatcher
Output:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
Session Tracking is a way to maintain state (data) of an user. It is also known as session
management in servlet.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
• Cookies
• Hidden Form Field
• URL Rewriting
• HttpSession
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
HttpSession:
The HttpServletRequest interface provides two methods to get the object of HttpSession:
public HttpSession getSession():Returns the current session associated with this request,
or if the request does not have a session, creates one.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
HttpSession Example:
Login page
request
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
HttpSession Example:
Login page
Next page
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
HttpSession Example:
Login page
Next page
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
URLRewriting:
In URL rewriting, we append a token or identifier to the URL of the next Servlet or the
next resource.
Advantages
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
URLRewriting Example:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
HiddenFields:
We store the information in the hidden field and get it from another servlet. This
approach is better if we have to submit form in all the pages and we don't want to depend
on the browser.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
HiddenFields Example:
Login form
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
Cookies:
A cookie is a small piece of information that is persisted between the multiple client
requests.
A cookie has a name, a single value, and optional attributes such as a comment, path and
domain qualifiers, a maximum age, and a version number.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
Servlet Session Tracking
Cookies Example:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Introduction
Introduction:
Java Server Pages (JSP) is a technology which is used to develop web pages by inserting
Java code into the HTML pages by making special JSP tags.
The JSP tags which allow java code to be included into it are <% —-java code—-%>.
JSP can consist of either HTML or XML (combination of both is also possible) with JSP
actions and commands.
JSP can be used for separation of the view layer with the business logic in the web
application.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Introduction
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Introduction
Web Container translates JSP code into a servlet class source(.java) file, then
compiles that into a java servlet class.
In the third step, the servlet class bytecode is loaded using classloader. The
Container then creates an instance of that servlet class.
The initialized servlet can now service request. For each request the Web
Container call the _jspService() method.
When the Container removes the servlet instance from service, it calls the
jspDestroy() method to perform any required clean up.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Introduction
JSP API
• javax.servlet.jsp
• javax.servlet.jsp.tagext
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Creating a JSP Page
A JSP page looks similar to an HTML page, but a JSP page also has Java code in it.
We can put any regular Java Code in a JSP file using a scriplet tag which start with
<% and ends with %>.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Creating a JSP Page
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Creating a JSP Page
Your JSP page looks like below. We will cover the details later.
Write something in your JSP file. The complete HTML and the JSP code, goes
inside the <body> tag, just like HTML pages.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Creating a JSP Page
To run your project, right click on the page, select Run As → Run on Server
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Scripting Element
These code inside <% %> tags are processed by the JSP engine during translation
of the JSP page.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Scripting Element
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Implicit Object
JSP provide access to some implicit object which represent some commonly used
objects for servlets that JSP page developers might need to use.
For example you can retrieve HTML form parameter data by using request
variable, which represent the HttpServletRequest object.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Implicit Object
JSP provide access to some implicit object which represent some commonly used
objects for servlets that JSP page developers might need to use.
Implicit Object Description
request The HttpServletRequest object associated with the request.
response The HttpServletRequest object associated with the response that is sent back to the browser.
out The JspWriter object associated with the output stream of the response.
session The HttpSession object associated with the session for the given user of request.
application The ServletContext object for the web application.
config The ServletConfig object associated with the servlet for current JSP page.
pageContext The PageContext object that encapsulates the enviroment of a single request for this current JSP
page
page The page variable is equivalent to this variable of Java programming language.
exception The exception object represents the Throwable object that was thrown by some other JSP page.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Include Directive
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Include Directive
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Taglib Directive
The JSP taglib directive is used to define a tag library that defines many tags.
We use the TLD (Tag Library Descriptor) file to define the tags.
In the custom tag section we will use this tag so it will be better to learn it in custom tag.
<%@ taglib uri="uriofthetaglibrary" prefix="prefixoftaglibrary" %>
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Taglib Directive
The JSP taglib directive is used to define a tag library that defines many tags.
We use the TLD (Tag Library Descriptor) file to define the tags.
In the custom tag section we will use this tag so it will be better to learn it in custom tag.
<%@ taglib uri="uriofthetaglibrary" prefix="prefixoftaglibrary" %>
The prefix is used to distinguish the custom tag from other libary custom tag.
Prefix is prepended to the custom tag name. Every custom tag must have a prefix.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Taglib Directive
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Taglib Directive
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Taglib Directive
<html>
<body>
<mytag:currentDate/>
</body>
</html>
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Exception Handling
Exception Handling
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Exception Handling
Exception Handling
isErrorPage attribute in page directive officially appoints a JSP page as an error page.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Exception Handling
You can also declare error pages in the DD for the entire Web Apllication. Using <error-
page> tag in the Deployment Descriptor.
You can even configure different error pages for different exception types, or HTTP error
code type(503, 500 etc).
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error.jsp</location>
</error-page>
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Exception Handling
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Action Tags
There are many JSP action tags or elements. Each JSP action tag is used to perform some
specific tasks.
The action tags are used to control the flow between pages and to use Java Bean.
jsp:param sets the parameter value. It is used in forward and include mostly.
jsp:fallback can be used to print the message if plugin is working. It is used in jsp:plugin.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Action Tags
The jsp:forward action tag is used to forward the request to another resource it may be
jsp, html or another resource.
<jsp:forward page="relativeURL | <%= expression %>">
<jsp:param name="parametername" value="parametervalue | <%=expression%>" />
</jsp:forward>
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Action Tags
The jsp:forward action tag is used to forward the request to another resource it may be
jsp, html or another resource.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Action Tags
Include action tag is used for including another resource to the current JSP page. The
included resource can be a static page in HTML, JSP page or Servlet. We can also pass
parameters and their values to the resource which we are including.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Action Tags
The useBean action is quite versatile. It first searches for an existing object utilizing the id
and scope variables. If an object is not found, it then tries to create the specified object.
Syntax of jsp:useBean:
<jsp: useBean id="unique_name_to_identify_bean"
class="package_name.class_name" />
Syntax of jsp:setProperty:
<jsp:setProperty name="unique_name_to_identify_bean" property="property_name" />
Syntax of jsp:getProperty:
<jsp:getProperty name="unique_name_to_identify_bean" property="property_name" />
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: Action Tags
Example:
Output
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: ExpressionLanguage
The Expression Language (EL) simplifies the accessibility of data stored in the Java Bean
component, and other objects like request, session, application etc.
There are many implicit objects, operators and reserve words in EL. ${ expression }
Implicit Objects Usage
pageScope it maps the given attribute name with the value set in the page scope
requestScope it maps the given attribute name with the value set in the request scope
sessionScope it maps the given attribute name with the value set in the session scope
applicationScope it maps the given attribute name with the value set in the application scope
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: ExpressionLanguage
EL param example:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: ExpressionLanguage
EL session example:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: ExpressionLanguage
EL cookie example:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: ExpressionLanguage
Precedence of Operators in EL
[] .
()
-(unary) not ! empty
* / div % mod
+ - (binary)
< <= > >= lt le gt ge
== != eq ne
&& and
|| or
?:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: ExpressionLanguage
Reserve words in EL
There are many reserve words in the Expression Language. They are as follows:
lt le gt ge
eq ne true false
and or not instanceof
div mod empty null
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: ExpressionLanguage
Reserve words in EL
There are many reserve words in the Expression Language. They are as follows:
lt le gt ge
eq ne true false
and or not instanceof
div mod empty null
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
The JSP Standard Tag Library (JSTL) represents a set of tags to simplify the JSP
development.
The JSTL core tag provides variable support, URL management, flow control etc. The
syntax used for including JSTL core library in your JSP is:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
JSTL tags
Tags Description
c:out It display the result of an expression, similar to the way <%=...%> tag work.
c:import It Retrives relative or an absolute URL and display the contents to either a String in 'var',a Reader in 'varReader' or
the page.
c:set It sets the result of an expression under evaluation in a 'scope' variable.
c:remove It is used for removing the specified scoped variable from a particular scope.
c:catch It is used for Catches any Throwable exceptions that occurs in the body.
c:if It is conditional tag used for testing the condition and display the body content only if the expression evaluates is
true.
c:choose, c:when, c:otherw It is the simple conditional tag that includes its body content if the evaluated condition is true.
ise
c:forEach It is the basic iteration tag. It repeats the nested body content for fixed number of times or over collection.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
JSTL <c:out>
The <c:out> tag is similar to JSP expression tag, but it can only be used with expression. It
will display the result of an expression, similar to the way < %=...% > work.
The < c:out > tag automatically escape the XML tags. Hence they aren't evaluated as
actual tags.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
JSTL <c:import>
The <c:import> is similar to jsp 'include', with an additional feature of including the
content of any resource either within server or outside the server.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
JSTL <c:set>
The <c:set> tag is JSTL-friendly version of the setProperty action. The tag is helpful
because it evaluates an expression and uses the results to set a value of a JavaBean or a
java.util.Map object.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
JSTL <c:remove>
JSTL <c:catch>
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
JSTL <c:forEach>
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
JSTL <c:forTokens>
JSTL <c:redirect>
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
The JSTL function provides a number of standard functions, most of these functions are
common string manipulation functions.
The syntax used for including JSTL function library in your JSP is:
fn:containsIgnoreCase() It is used to test if an input string contains the specified substring as a case insensitive way.
fn:endsWith() It is used to test if an input string ends with the specified suffix.
fn:escapeXml() It escapes the characters that would be interpreted as XML markup.
fn:trim() It removes the blank spaces from both the ends of a string.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
fn:substring() It returns the subset of a string according to the given start and end position.
fn:length() It returns the number of characters inside a string, or the number of items in a collection.
fn:replace() It replaces all the occurrence of a string with another string sequence.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
contains
containsIgnoreCase
endsWith
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
indexOf
trim
startsWith
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
split
toLowerCase
toUpperCase
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
split
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
The formatting tags provide support for message formatting, number and date
formatting etc.
The url for the formatting tags is http://java.sun.com/jsp/jstl/fmt and prefix is fmt.
The JSTL formatting tags are used for internationalized web sites to display and format
text, the time, the date and numbers.
The syntax used for including JSTL formatting library in your JSP is:
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
fmt:formatDate It formats the time and/or date using the supplied pattern and styles.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
The JSTL sql tags provide SQL support. The url for the sql tags is
The SQL tag library allows the tag to interact with RDBMSs (Relational Databases) such as
Microsoft SQL Server, mySQL, or Oracle.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
sql:query It is used for executing the SQL query defined in its sql attribute or the body.
sql:update It is used for executing the SQL update defined in its sql attribute or in the tag body.
sql:param It is used for sets the parameter in an SQL statement to the specified value.
sql:dateParam It is used for sets the parameter in an SQL statement to a specified java.util.Date value.
sql:transaction It is used to provide the nested database action with a common connection.
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
JSP: JSTL
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .
THANK YOU
Copyright © 2009 iPrimed, all rights reserved. This presentation contains information and data that is confidential and proprietary to iPRIMED .