Sunday, 18 August 2013

if else if in jstl , if else


JSTL is the Java Server Pages Standard Tag Library. JSTL encapsulates, as simple tags, core functionality common to many JSP applications.


JSTL includes core tags to support iteration, conditionals, and expression-language support. It also supports EL functions for string manipulation. how these tags work, you should read the JSTL specification

Iteration
The core iteration tag is , which iterates over most collections and similar objects you'd think to iterate over. lets you iterate over tokens in a String object; it lets you specify the String and the delimiters.

Conditionals
JSTL supports a simple conditional tag along with a collection of tags -- , , and -- that support mutually exclusive conditionals. These latter three tags let you implement a typical if/else if/else if/else structure.

Expression language
JSTL provides a few tags to facilitate use of the expression language. prints out the value of a particular expression in the current EL, similar to the way that the scriptlet expression (<%= ... %>) syntax prints out the value of a expression in the scripting language (typically Java). lets you set a scoped attribute (e.g., a value in the request, page, session, or application scopes) with the value of an expression.

Text inclusion
JSP supports the jsp:include tag, but this standard action is limited in that it only supports relative URLs. JSTL introduces the c:import tag, which lets you retrieve absolute URLs. For instance, you can use c:import to retrieve information from the web using HTTP URLs, or from a file server using an FTP URL. The tag also has some advanced support for performance optimizations, avoiding unnecessary buffering of data that's retrieved.

I18N-capable text formatting
Formatting data is one of the key tasks in many JSP pages. JSTL introduces tags to support data formatting and parsing. These tags rely on convenient machinery to support internationalized applications.

XML manipulation
You can't look anywhere these days without seeing XML, and JSTL gives you convenient support for manipulating it from your JSP pages. Parse documents, use XPath to select content, and perform XSLT transformations from within your JSP pages.

Database access
Easily access relational databases using the SQL actions. You can perform database queries, easily access results, perform updates, and group several operations into a transaction.

Functions
String manipulations can be performed using the functions provided in JSTL.


Iterator Tags

The forEach tag allows you to iterate over a collection of objects.


The forTokens tag is used to iterate over a collection of tokens separated by a delimiter.


Conditionals if else if ladder in jstl :-











After executing jstlview.jsp you we get following output :-



No comments:

Post a Comment