Posts

Showing posts from June, 2022

JSTL-JSP Standard TagLibrary -Tutorial

Image
  JSTL  (JSP standard Tag Library)   JSPHome The purpose of Tag Library is, without having any coding knowledge one should be able to write, debug, and trace the code.   JSTL technology  adapted from cold fusion. Tags available in this library(version 1.2) are as follows.. 1. core     prefix: c     Syn:     <%@ taglib prefix= "c" uri= "http://java.sun.com/jsp/jstl/core" %> 2. sql → connecting to database for CRUD operations.       prefix: sql     Syn:     <%@ taglib prefix= "sql" uri= "http://java.sun.com/jsp/jstl/sql" %> 3. xml → parsing, reading, querying XML files.     prefix: x     Syn:     <%@ taglib prefix= "sql" uri= "http://java.sun.com/jsp/jstl/sql" % >      4. format  → Internationalization (i18n)     prefix: fmt     Syn:      <%@ taglib prefix= "fmt" uri= "http://java.sun.com/jsp/jstl/fmt" %> 5. functions → creating and invoking user defined functions.

Jsp Drectives tutorial

Image
  How to use  directives in JSP   III. Jsp Drectives     JSPHome What are Directives in JSP?   Directives in JSP Page, are nothing but elements of JSP code, which directs web container at the time of converting, JSP page to servlet.  Directive provides special information, messages about the entire JSP page which is used in processing of the page. This information is global.  There are three types of directive tags available in JSP.   page  include  taglib All directives start with @ symbol. <%@ %> → directives used to import library files. Page directive example:     <%@ page import= "javal.util.*;" %> include directive It includes files like html,jsp,xml at compile time to this page. <%@ include file= "relativeurl" %> <%@ include file= "header.html" %>   example : pageIndludedemo.jsp --------------- <%@ page pageEncoding= "UTF-8" %> <%@ include file= "PageDemo.jsp&q

Actions in JSP

Image
    IV. Actions     JSP Home JSP actions use the construct in XML syntax to control the behavior of the servlet engine.  The JSP specification provided a standard tag called Action tag, that can be used within JSP code and allows us  to eliminate Scriptlet code from the JSP code.   Some actions tags given below.You will learn about each of them with examples in this tutorial. <jsp:useBean> <jsp:setProperty> <jsp:getProperty> <jsp:param> <jsp:include> <jsp:plugin> These actions perform some specific tasks and are predefined. They provide functionalities like     Dynamic insertion of a file in jsp     Controlling behavior of the servlet engine     Forwarding a user to another page     Controlling logic flow between pages    How to use bean  in JSP   A bean is a Java class Object.  Declaring a Bean in JSP Syntax: <jsp:useBean id=" bean id" scope=" page " class=" Class Name " type=" Bean Classname " %&g

Implicit Objects in JSP

Image
    II. Implicit objects in JSP There are 9 implicit (built-in) Objects available in JSP. All are used to perform different type of tasks in a web application. Such as receiving request from client, sending response to client. Printing messages on  pages, maintaining sessions, setting different types of parameters at page and application level, handling exceptions and so on.    The below given tables shows a list of Implicit Objects, their class type and usage.   JSP Home ***      implicit object should not be used inside the declaration ***      implicit object should be used in scriptlet and expression   reuestdemo.jsp   <!DOCTYPE html> <html> <head> <title> Codingzon JSP Demos </title> </head> <body>   <%! String str = null ; %> <%     str = request. getParameter ( "username" );  out. println ( "<br>Hello " + str); %>   </body> </html>       URL:  Use the followi

JSP Introduction in Java

Image
 Introduction to JSP     JSPHome   JSP's allow to design user interfaces. JSP pages used for presentation of content. Hard coding of HTML Code into Servlet, they invented the JSP. Presentation code  embedded inside servlets. This will make web developer should have servlet knowledge. But JSP pages  makes the flexibility in developing presentation content by separating the  application logic from presentation logic. JSP is converted into servlets at the time of compilation. All the code which is written in scriptlets is inserted into servlets doGet() method. Programming in JSP.   JSP Elements Scripting elements   implicit objects  directives  actions  comments              <!-- --> HTML user will use (for documentation).           <%- - -- %> script let are not visible in client output. I. Scripting elements : In this tutorial, you are just going to learn how to use script lets. There are 3 types of scripting elements available in JSP. script l