站内搜索: 请输入搜索关键词

当前页面: 开发资料首页JSP 专题JSP语法格式

JSP语法格式

摘要: JSP语法格式

JSP语法讲解<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

()指令讲解

Page指令

<%@ page

[language=”java”]

[import=”package.class,……”]

[contentType=”text/html”;charset=”GB3212”]

[session=”True|false”]

[buffer=”none|8kb|sizekb”]

[autoFlush=”True|false”]

[isThreadSafe=”True|false”]

[info=”text”]

[errorPage=relativeURL]

[isErrorPage=”True|false”]

[extends=”package.class”]

%>

include 指令

<@ include file=”fileName”>包含一个静态文件

Include动作指令

(1)

(2)

forward动作指令

(1) page=”path”>

(2) page=”path”>

useBean指令

id=”name” scope=”page|request|session|application” class=”package.className” />

getProperty指令

name=”beanName” property=”propertyName”/>

setProperty指令

name=”beanName” prop_expr />

prop_expr有以下几种可能的情形:

property=”*” | property=”propertyName” |

property=”propertyName” param=”parameterName” |

property=”propertyName” value=”propertyValue”

(二)内建对象讲解

JSP的内建对象有以下几种:requestresponseoutSessionpageContextapplicationconfig page

request对象的主要方法:

1、 getParameter(String name) return String

2、 getParameterNames() return Enumeration

3、 getParameterValues(String name) return String[]

out对象的主要方法

1、 out.print(String name)

Session对象的主要方法:

1、 getAttribute(String name) return Object

2、 getAttributeNames() return Enumeration

3、 getCreationTime() return long

4、 getId() return String

5、 GetLastAccessedTime() return long

6、 GetMaxInactiveInterval() return int

7、 RemoveAttribute(String name) void

8、 SetAttribute(String name , java.lang.Object value) void

application对象的主要方法:

1、 getAttribute(String name) return Object

2、 getAttributeNames() return Enumeration

3、 getInitParameter(String name)

4、 getServletInfo()

5、 setAttribute(String name , Object object)



↑返回目录
前一篇: 菜鸟学jsp(一)
后一篇: jsp中javaBean的运用