Directives are used to give page specific information.
|
|
Directive
|
Syntax
|
Example
|
page
|
<%@ page attribute = "value" %>
|
<%@ page import = "java.util.*" %>
|
include
|
<%@ include file = "url" %>
|
<%@ include file = "info.htm" %>
|
taglib
|
<%@ taglib uri = "identifier" prefix = "name" %>
|
<%@ taglib uri = "web-info/myTags.tld" prefix = "c" %>
|
Scripting elements are used to give snippets of Java code or comments.
|
|
Scripting
|
Syntax
|
Example
|
Java declaration
|
<%! declaration %>
|
<%! int count %>
|
Scriptlet code
|
<% code to execute" %>
|
<% i = aValue * 1000 %>
|
Evaluated output
|
<%= expression %>
|
<%= new java.util.Date() %>
|
JSP comment
|
<%-- comment --%>
|
<%-- Only in JSP page --%>
|
HTML comment
|
<!-- comment --%>
|
<!-- Seen in html page --%>
|
Actions are programming commands that create, change or use other objects.
|
Action
|
Syntax
|
useBean
|
<jsp:useBean id = "beanName" />
|
include |
<jsp:include page = "url" flush = "boolean" />
|
setProperty
|
<jsp:setProperty name = "beanName" property = "propertyName" %>
|
getProperty
|
<jsp:getProperty name = "beanName" property = "propertyName" %>
|
forward |
<jsp:forward page = "relative url" />
|
plugin |
<jsp:plugin attribute = "value" />
|
Type
|
Example
|
Scripting element
|
<%! java.util.Date now = new java.util.Date(); %>
|
Action command
|
<jsp:useBean id="now" class="java.util.Date" />
|
|
Main Index
Comments
UK SPONSERS
USA SPONSERS
|