JSP PPT Presentation
JSP PPT Presentation
JSP PPT Presentation
JSP is a java based technology used to simplify the development of dynamic web pages. JSP is used to separate dynamic content of web page from its content with the help of HTML and JSP tags. Current version is 2.1.
5. Destroying stage
3. Taglib Directives:Taglib tag is used to include external tag library in your web page. Attributes are:-
1.Uri=url of taglibrary
2.tagDir=tag library directory 3.prefix=like object for library
1. <%! This is a declaration %> 2. <% this is a scriptlet %> 3. <% = this is an expression %>
this action used to access the defines property to bean object.But it is important to declare bean object using useBean tag.
Attributes are:-
<jsp:getProperty name=beannameproperty=propertyname>
this action used to access the defines property to bean object.But it is important to declare bean object using useBean tag.
Attributes are:-
<jsp:getProperty name=beannameproperty=propertyname>
We are creating a login screen with java bean which check the username and password and return the result according to input
INDEX.JSP <%-DOCUMENT : INDEX CREATED ON : APR 2, 2012, 12:23:12 PM AUTHOR : BARDHAN --%>
<%@PAGE CONTENTTYPE="TEXT/HTML" PAGEENCODING="UTF-8"%> <!DOCTYPE HTML> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UTF-8"> <TITLE>JSP PAGE</TITLE> </HEAD> <BODY> <FORM ACTION="CHECK.JSP" METHOD="POST"> ENTER NAME <INPUT TYPE="TEXT" NAME="NAME" /><BR> ENTER PASSWORD <INPUT TYPE="PASSWORD" NAME="PASSWORD" /> <BR/> <INPUT TYPE="SUBMIT" VALUE="LOGIN" /> <INPUT TYPE="RESET" VALUE="RESET" /> </FORM> </BODY> </HTML>
CHECK.JSP PAGE:<%-DOCUMENT : CHECK CREATED ON : APR 2, 2012, 12:29:55 PM AUTHOR : BARDHAN --%> <%@PAGE CONTENTTYPE="TEXT/HTML" PAGEENCODING="UTF-8"%> <!DOCTYPE HTML> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UTF-8"> <TITLE>JSP PAGE</TITLE> </HEAD> <BODY> <JSP:USEBEAN ID="LOGIN" CLASS="BEANS.LOGIN" SCOPE="PAGE"> <JSP:SETPROPERTY NAME="LOGIN" PROPERTY="*" /> </JSP:USEBEAN> YOUR NAME:<JSP:GETPROPERTY NAME="LOGIN" PROPERTY="NAME" /> <BR> YOUR PASSWORD IS:<JSP:GETPROPERTY NAME="LOGIN" PROPERTY="PASSWORD" /> <%BOOLEAN BA=LOGIN.GETRESULT(); IF(BA) { RESPONSE.SENDREDIRECT("WELCOME.JSP"); } ELSE{ OUT.PRINTLN("THIS IS NOT RIGHT USERNAME OR PASSWORD"); } %> </BODY> </HTML>
Bean.login bean:/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package beans;
/** * * @author BARDHAN */ public class login { private String name; private String password; private boolean result; public String getName() { return name; }
} }
This action element is used to pass the parameter to other action elements. For example
<jsp:forward page=hello.jsp>