已解决问题
谷歌xxaxbbd123用户在2016.04.28提交了关于“天堂岛JSP基本语法”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-07-31T19:30:03。希望大家能够帮助她。详细问题描述及疑问:期待您的答案,你无异于雪中送炭,让我感激涕零 !
详细问题描述及疑问:期待您的答案,你无异于雪中送炭,让我感激涕零 !
一,
1,脚本
2,指令元素
3,动作元素,系统元素:
js
jsp:
code="classfileName"
codebase="classf
align=?
archiv
jrev
titl
nsplugi**rl="可以为Netscape下载
ieplug
jsp:params由jsp:plugin封装一个js
jsp:fallback
jsp:useBean
id="实例名"
scope="pa
class="类名,若无type则须有class,若有be
beanName="a.b.c|a/b/c.cer,与class不两立"
type="有同接口的类名,或类实现的接口名(只能使用接口中的方法)"
jsp:setPropertyname="bean实例id"property="bean须有setPropertyName()的方法"[param=?]value=?若不指定value则从request中取与property名字相同或param名字相同的变量,若值为""不执行
jsp:getPropertyname="beanid"property="bean属性,须有getPropertyName()方法"该动作元素直接输出
4,空白字符:空格(0x20),Tab(0x09),回车(0x0d0a),jsp页面中的这些符号都会被out.println
5,转义字符%>,,%>,',"都应当用转义
二,隐藏对象
1,requestj**ax.servlet.h**ttpServletRequest类型,
StringgetParameter(StringparameterName);
j**a.util.E**merationgetParamerterNames();
String[]getParameterValues();
ObjectgetAttribute(Stringname);
j**a.util.E**merationgetAttributeNames();
voidremoveAttribute(StringattributeName);
voidsetAttribute(Stringname,Objectobject);
j**ax.servlet.http.Cookie[]getCookies();
j**a.util.E**merationgeth**eaderNames();//消息头
j**a.util.E**merationgeth**eaders(StringheaderName);
Stringgeth**eader(StringheaderName);
intgetInth**eader(StringheaderName);
longgetDateh**eader(StringheaderName);
StringgetMethod();//请求方法
StringgetRequestURI;//协议名和查询字符串之间,无主机名
StringgetContextPath();//请求的文件所在的应用程序环境
StringgetServletPath();//以contextPath为根,指定小程序或jsp所在的位置
StringPathInfo();//额外的路径信息
StringgetQueryString();
booleanisSecure();//是否用了h**TTPS
booleanisRequestedSessionIdFromCookie();
booleanisRequestedSessionIdFromURL();
booleanisRequestedSessionIdValid();//请求会话的ID是否有效
j**a.util.LocalegetLocale();//客户同意内容所采取的Locale,取决于AcceptLanguge
j**a.util.E**merationgetLocales();
2,responsej**ax.servlet.http.h**ttpServletResponse
intgetBufferSize();
voidsetBufferSize(intsize);//
booleanisCommitted();//写入状态码和报头后,响应是否已提交
voidreset();//**缓存内的所有**包括状态码和报头
voidflushBuffer();//强制缓存中的任何内容写入客户
voidaddh**eader(Stringname,Stringvalue);
voidseth**eader(Stringname,Stringvalue);
voidaddDateh**eader(Stringname,longdate);
voidsetDateh**eader(Stringname,longdate);
voidaddInth**eader(Stringname,intvalue);
voidsetInth**eader(Stringname,intvalue);
booleancontainsh**eader(Stringname);
voidsetContentType(Stringtype);
voidsetLocale(j**a.uti.Locale,locale);
voidsendError(intsc,Stringmsg);
voidsendError(intsc);//状态码和描述性信息项客户发送错误响应
voidsendRedirect(Stringlocation);
3,pageContextj**ax.servlet.jsp.PageContext(由具体开发商完成具体化)
/*intscope:
***.PAGE_SCOPE
pageContext.REQUEST_SCOPE
pageContext.**SSION_SCOPE
pageContext.APPLICATION_SCOPE
*/
ObjectgetAttribute(Stringname);//pageScope变量
ObjectgetAttribute(Stringname,intscope);
ObjectfindAttribute(Stringname);
j**a.util.E**merationgetAttributeNamesInScope(intscope);
intgetAttributeScope(Stringname);
voidremoveAttribute(Stringname);
voidremoveAttribute(Stringname,intscope);
voidsetAttribute(Stringname,Objectobject);
voidsetAttribute(Stringname,Objectobject,intscope);
j**ax.servlet.jsp.JspWritergetOut();//out
ExceptiongetException();//exception
j**ax.servlet.ServletRequestgetRequest();//request
j**ax.servlet.ServletResponsegetResponse();//response
j**ax.servlet.http.h**ttpSessiongetSession();//session
j**ax.servlet.ServletConfiggetServletConfig();//config
j**ax.servlet.ServletContextgetServletContext();//application
j**ax.servlet.jsp.JspWriterpopBody();
j**ax.servlet.jsp.tagext.BodyContentpushBody();//管理taglib**的嵌套输出流
voidforward(StringrelativeUrlPath);
voidinclude(StringrelativeUrlPath);
voidhandleException(j**a.lang.Exceptione);
4,sessionj**ax.servlet.http.h**ttpSession
//安装cookie
//URL重写
//SSL会话
ObjectgetAttribute(StringattributeName);
j**a.util.E**merationgetAttributeNames();
voidsetAttribute(Stringname,Objectvalue);
voidremoveAttribute(Stringname);
longgetLastAccessedTime();//最后一次发送本次session相关**的时间
/*关于long型时间:指从1970-1-100:00:00开始的毫秒数*/
voidsetMaxInactiveInterval(intinterval);//秒为单位
intgetMaxInactiveInterval();
voidinvalidate();//使会话无效
5,outj**ax.servlet.jsp.JspWriter
//错误是会引发j**a.io.IOException
voidclear();//**缓冲区,response.reset()?
voidclearBuffer();//**缓冲区当前内容
voidflush();//
voidclose();//先刷新再关闭
intgetBufferSize();
intgetRemaining();//还没有使用的缓冲区
booleanisAutoFlush();//pageautoFlush属性
voidprint(Objectobject);
voidprintln(Objectobject);
6,applicationj**ax.servlet.ServletContext
StringgetInitParameter(Stringname);
j**a.util.E**merationgetInitParameterNames();
ObjectgetAttribute(Stringname);
voidsetAttibute(Stringname,Objectobject);
j**a.util.E**merationgetAttributeNames();
voidremoveAttribute(Stringname);
//修改的时候,isThreadSafe最好设成false,而且用synchronized()
j**a.net.URLgetResource(Stringpath);
//URL::getPath()跟application.getRealPath()一样
j**a.io.InputStreamgetResourceAsStream(Stringpath);//同URL::openStream();
//RequestDispatcher:工作在服务器笑程序之间的服务
j**ax.servlet.RequestDispatchergetNamedDispatcher(Stringname);//name为servlet的名称
j**ax.servlet.RequestDispatchergetRequestDispatcher(Stringpath);//path为servlet的路径
voidlog(Stringmessage);
voidlog(Stringmessage,Throwablethrowable);//将一个消息和栈跟踪记录到小程序日志文件中
StringgetMimeType(Stringfile);
StringgetRealPath(StringvirtualPath);//URL::getPath
StringgetServerInfo();
intgetMajorVertion();
intgetMinerVertion();
7,configj**ax.servlet.ServletConfig
StringgetInitParameter(Stringname);
j**a.util.E**merationgetInitParameterNames();
StringgetServletName();
ServletContextgetServletContext();
8,pagej**ax.servlet.jsp.h**ttpJspPage
//通常不是JSP页面的创作者使用
j**ax.servlet.ServletConfiggetServletConfig();
StringgetServeletInfo();
9,exceptionj**a.lang.Exception
StringgetLocalizedMessage();
StringgetMessage();
voidprintStackTrace();
voidprintStackTrace(j**a.io.PrintStreamps);
voidprintStackTrace(j**a.io.PrintWriterpw);