ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [JSP] Directives (JSP지시어)
    Web/JSP 2019. 7. 11. 18:10

    JSP지시어에는 page, include, taglib가 있다.

    JSP컨테이너에 해당 페이지를 어떻게 처리해야 하는지 전달하기 위한 내용을 담는다.

     

    1. page지시어

    <%@ page 속성명1="속성값"   속성명2="속성값"   속성명3="속성값" %>

    사용할수 있는 속성

    - contentType, pageEncoding, import (, 를기준으로 여러개를 사용할 수도 있다.)

    - session : JSP페이지가 세션을 사용할 지의 여부 지정. false지정시 나와 브라우져는 남남이 된다. 로그인처리가 안된다.

    - buffer(8kb) : JSP페이지의 출력버퍼 크기를 지정한다.

    - autoFlush : true이면 buffer가 넘치더라도 출력버퍼 크기를 자동으로 늘려준다. 하지만 false면 overflow에러 즉, 500

      에러가 발생한다.

    - errorPage : 에러 발생시 이동할 페이지를 지정하는 것이다.

      매번 쓸때마다 귀찮으니 wep.xml에 추가한다. 물론 에러시 이동할 jsp파일 하나 생성을 해야겟지? 

    <error-page>
    	  <!-- <error-code>500</error-code> -->
    	  <exception-type>java.lang.ArithmeticException</exception-type>
    	  <!-- location은 무조건, 위 두개는 택1 -->
    	  <location>/0711/error.jsp</location>
    </error-page>

    isErrorPage

     

    2. include

    <%@include file="경로명"%>

    <h3>include directive 테스트	</h3>
    	<hr>
    	<%@include file="menu.jsp" %>
    	<table border="0" cellpadding="5">
    		<tr>
    			<td align="left">
    				<font size="-1"><%@include file="shopping.jsp" %></font>
    			</td>
    			<td width="30">&nbsp;</td>
    			<td align="left">
    				<font size="-1"><%@include file="news.jsp" %></font>
    			</td>
    		</tr>
    	</table>

    html의 모든 코드들을 모아서 하나의 JSP 서블릿이 생성된다.

     

    3. taglib

     

     

    반응형

    댓글

Designed by Tistory.