2021年4月13日 星期二

Jsp init-param web.xml

 <servlet>

<servlet-name></srvlet-name>

<jsp-file></jsp>

<init-param>

<param-name></param-name>

<param-value></param-value>

</init-param>

</servlet> 

<%!

public void jspInit(){}

public void jspDestory(){}

%>

 ServletJSP
ApplicationgetServletContext().setAttribute(key,value);application.setAttribute(key,value);
Resquestrequest.setAttribute(key,value);request.setAttribute(key,value);
Sessionrequest.getSession().setAttribute(key,value);session.setAttribute(key,value);
PageNONEpageContext.setAttribute(key,value);

 

pageContextˋ這jsp隱含變數有一特殊功能可指定存取任何範圍的attribute

pageContext.setAttribute(key,value); -->page範圍

pageContext.setAttribute(key,value,PageContext.SESSION_SCOPE); -->session範圍

如不確定是哪一範圍可用

pageContext.findAttribute(key)尋找

isErrorPage

errorPage

<web-app>

<jsp-config>

    <jsp-property-group>

         <url-pattern>*.jsp</url-pattern>

         <scripting-invalid>true</scripting-invalid>

    </jsp-property-group>

</jsp-config> 

</web-app>

${application.sno} <!-- Expreesion Language use -->

沒有留言: