Pure JSP

来源:互联网 发布:mysql 从库 编辑:程序博客网 时间:2024/04/29 20:05


 

C_OneOver_viewNote: The first time the file is requested,it is compiled into a servlet object and stored in memory,and the output is sent back to the requesting client.After the first request,the server checks to see whether the *.jsp file has changed.If it has not changed,then the server invokes the previously compiled servlet object.Note:A key thing to remember about JSPs is that they are just servlets that are created from a combination of HTML text and Java source code.This means that they contain all the functionality of a normal servlet.DirectivesDirectives are JSP elements that provide global information about an entire JSP page.The page Directive<%@page language="java"%>The inluce Directive<%@include file="relativeURLspec"%>The taglib Directive<%@taglib uri="tagLibraryURI"prefix="tagPrefix"%>ActionsActions provide an abstraction that can be used to easily encapsulate common tasks.They typically createor act on objects,normally JavaBeans.The JSP technology provides some standard actions.Theseactions are defined in the following sections<jsp:useBean><jsp:setProperty><jsp:getProperty><jsp:include><jsp:forward><jsp:param><jsp:plugin>Implicit ObjectsAs a JSP author,you have access to certain implicit objects that are available for use in JSP documents,without being declared first.To satisfy the JSP specification,all JSP scripting languages must provideaccess to the objects JSP ScriptingJSP scripting is a mechanism for embedding code fragments directly into an HTML page.There are threescripting language elements involved in JSP scripting.Each of these JSP scripting elements has itsappropriate location in the generated servlet.In this section we will look at these elements and howtogether they will result in a complete servlet.Declarations   <%!declaration%>A sample variable declaration using this syntax is declared here:<%!String name=new String("BOB");%>A sample method declaration using the same syntax is declared as follows:<%!public String getName(){return name;}%>Expressions<%=expression%>A code snippet containing a JSP expression is shown here:Hello<B><%=getName()%></B>Scriptlets<%scriptlet source%>
原创粉丝点击