Knowledge of JSP for interview

本文介绍了JSP页面中的三个核心指令:@page、@include 和 @taglib 的使用方法。详细解释了如何通过这些指令配置页面属性、静态包含文件及引入标签库。此外还涵盖了七个JSP动作元素,包括页面跳转、参数传递、动态包含等功能。

Three compile command of JSP: @page,@include,@taglib

<%@page
[language="Java"]
[extends="package.class"] --the parent class should be extended
[import= "package. class | package. *},…"] --import some package for your java code
[session="true | false"] --whether need HTTP sesison
[buffer="none | 8kb | size kb" 1
[autoFlush="true I false"]
[isThread8afe="true | false"]
[info="text"] --Servlet.getServerInfo()
[errorPage="relativeURL"] --when the error or exception thrown,skip to the errorpage pointed.
[contentType="mimeTyPe[ ;charset=characterSet]" | "text/html;charSet=ISO808859-1"]
[isErrorPage=" true | false"]
%>

<%@include file="include.jsp" %>,this is the static command,if the file included always need change
,it should use <jsp:include> which is the dynamic operation.it always check the jsp file included and
The included jsp and the main jsp joined together when output.
All the setttings of page,the object used of Dynamic include should create itself.but they have the same scope
of request.
The static include jsp can use the settings of main jsp,they are a whole servlet.

 

Seven action command:
jsp:forward: make the page redirect,request of handling will go to the page forward.
 <jsp:forward page=" {relativeURL | <%=expression%>}">
 {<jsp:param.../>}
 </jsp:forward>
jsp:param: deliver the params.
jsp:include: Dynamic include a jsp.
jsp:plugin: download the JavaBean or Applet to client server.
jsp:useBean: use JavaBean .
jsp:setProperty: set the propety of JavaBean instance.
jsp:getProperty: get the propety of JavaBean instance.

 

nine object embedded:
application: the instance of javax.servlet.ServletContext,valid in the whole web application
config:the instance of javax.servlet.ServletConfig
exception:the instance of java.lang.Throwable
out:the instance of javax.servlet.jsp.JspWriter
page: 'this' of Servlet
pageContext: the instace of Javax.servlet.jsp.PageContext
request:the instace of javax.servlet.http.HttpServletRequest
response:the instace of javax.servlet.http.HttpServletResponse
session: the instace of javax.servlet.http.HttpSession

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值