Topic: JSP语法讲解

  Print this page

1.JSP语法讲解 Copy to clipboard
Posted by: luckyboy
Posted on: 2003-01-04 15:16

摘自:http://www.csdn.net/develop/article/16/16308.shtm

(一)指令讲解



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)<jsp:include page=”fileNamePath” flush=”True”>



(2)<jsp:include page=”fileNamePath” flush=”True”>

<jsp:param name=”paramName” value=”paramValue”>

</jsp:include>





forward动作指令

(1)<jsp:forward page=”path”>



(2) <jsp:forward page=”path”>

<jsp:param name=”paramName” value=”paramValue”>

</jsp:forward>





useBean指令

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





getProperty指令

<jsp:getProperty name=”beanName” property=”propertyName”/>



setProperty指令

<jsp:setProperty name=”beanName” prop_expr />

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

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

property=”propertyName” param=”parameterName” |

property=”propertyName” value=”propertyValue”





(二)内建对象讲解



JSP的内建对象有以下几种:request、response、out、Session、pageContext、application、config、 page



request对象的主要方法:

1、 getParameter(String name)

2、 getParameterNames()

3、 getParameterValues(String name)



out对象的主要方法:

1、 out.print(String name)



Session对象的主要方法:

1、 getAttribute(String name)

2、 getAttributeNames()

3、 getCreationTime()

4、 getId()

5、 GetLastAccessedTime()

6、 GetMaxInactiveInterval()

7、 RemoveAttribute(String name)

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



application对象的主要方法:

1、 getAttribute(String name)

2、 getAttributeNames()

3、 getInitParameter(String name)

4、 getServletInfo()

5、 setAttribute(String name , Object object)

2.Re:JSP语法讲解 [Re: luckyboy] Copy to clipboard
Posted by: mabinde
Posted on: 2003-01-14 20:50

test


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923