PAGE DIRECTIVE
<%@ page import=”java.util.*” %>
DECLARATION
<! int num = 10;>
SCRIPLET
<% out.println(num) %>
EXPRESSION
<%=num%>
<%= pageContext.getAttribute(“foo”) %>
ACTION
<jsp:include page=”foo.html” />
EL EXPRESSION
${pageContext.request.contextPath}
${pageContext.foo}
JSP USEBEAN
<jsp:useBean id="" class="" type="" scope="">BODY</jsp:useBean>
*id = Unique Name of the Bean (i.e. Object Name)<br>
type (reference type) = Type of the Bean<br>
*class (object type) = Class of the Bean<br>
Scope = Scope of the Bean (i.e. page, request, session, application)<br>
i.e. Type id = new Class();
jsp:useBean =
Create the new object of the specified class. with type specified in the type="" attribute. First it will find the object in the specified scope. and if it is not available then it will create the object and will store the object in the specified scope.
Body gets evaluated only if new object is getting created.
<jsp:getProperty name=”beanId” property=”name” />
using get tag we can get particular property of the bean object.
<jsp:setProperty name=”beanId” property=”name” value=”Fred” />
using set tag we can set particular property value for the bean object
Keep Visiting :)
Give your valuable Comment
<%@ page import=”java.util.*” %>
DECLARATION
<! int num = 10;>
SCRIPLET
<% out.println(num) %>
EXPRESSION
<%=num%>
<%= pageContext.getAttribute(“foo”) %>
ACTION
<jsp:include page=”foo.html” />
EL EXPRESSION
${pageContext.request.contextPath}
${pageContext.foo}
JSP USEBEAN
<jsp:useBean id="" class="" type="" scope="">BODY</jsp:useBean>
*id = Unique Name of the Bean (i.e. Object Name)<br>
type (reference type) = Type of the Bean<br>
*class (object type) = Class of the Bean<br>
Scope = Scope of the Bean (i.e. page, request, session, application)<br>
i.e. Type id = new Class();
jsp:useBean =
Create the new object of the specified class. with type specified in the type="" attribute. First it will find the object in the specified scope. and if it is not available then it will create the object and will store the object in the specified scope.
Body gets evaluated only if new object is getting created.
<jsp:getProperty name=”beanId” property=”name” />
using get tag we can get particular property of the bean object.
<jsp:setProperty name=”beanId” property=”name” value=”Fred” />
using set tag we can set particular property value for the bean object
Keep Visiting :)
Give your valuable Comment
No comments:
Post a Comment