Servlet Scope

Servlet Scope

<% @ page language = "java" contentType = "text/html; charset=UTF-8"

pageEncoding = "UTF-8" %>

< !DOCTYPE html >

< html >

< head >

< meta charset = "UTF-8" >

< title > Insert title here < / title >

< / head >

< body >

<% //jsp 표준태그 , jsp실행 -> HTML 추가 -> HTML화면 응답

String mesg = ( String )request.getAttribute( "request" );

String mesg2 = ( String )session.getAttribute( "session" ); //jsp는 세션을 session내장객체로 바로 사용가능

String mesg3 = ( String )application.getAttribute( "application" ); //ServletContext도 마찬가지로 내장객체로 바로사용

System . out . println ( "Practice.jsp : " + mesg + "\t" + mesg2 + "\t" + mesg3);

%>

request : <% = request.getAttribute( "request" ) %> < br >

session : <% = session.getAttribute( "session" ) %> < br >

application : <% = application.getAttribute( "application" ) %> < br >

< hr border = "2" >

1>> <% = mesg %>

2>> <% = mesg2 %>

3>> <% = mesg3 %>

<% = "aaaaaaaaaaaaaaa" %>

< hr >

< / body >

from http://cocoshin.tistory.com/42 by ccl(A) rewrite - 2021-12-16 02:28:10