¼Ò¼³°°ÀºJSP1ºÎ  5Àå Core of JSP  05 ³»À尴ü pageContext  

 

05 ³»À尴ü pageContext

 

 pageContext ³»À尴ü´Â PageContext Ŭ·¡½ºÇüÀÇ °´Ã¼ÀÔ´Ï´Ù. ÀÌ PageContext Ŭ·¡½º´Â ´Ù¸¥ ³»À尴üµéÀ» »ý¼ºÇÏ´Â ¸Þ¼­µå¸¦ °¡Áö°í ÀÖ´Â Ãß»ó Ŭ·¡½ºÀÔ´Ï´Ù. ±×·¡¼­ ÀÌ Å¬·¡½ºÀÇ °´Ã¼ÀÎ pageContext´Â request, response¸¦ Á¦¿ÜÇÑ ³»À尴ü Áß¿¡¼­ °¡Àå ¸ÕÀú »ý¼ºµÇ´Â °´Ã¼ ÀÔ´Ï´Ù. pageContext´Â ´Ù¸¥ ³»À尴ü¸¦ »ý¼ºÇÏ´Â °Í »Ó¸¸ ¾Æ´Ï¶ó, JSP ÆäÀÌÁö³»ÀÇ Á¦¾î±ÇÀ» Á¤ÀÇÇÏ´Â ±â´ÉÀÌ ÀÖ½À´Ï´Ù.

 

 ±×·³ ¸ÕÀú pageContext °´Ã¼°¡ »ý¼ºµÇ´Â °Í¿¡ ´ëÇØ¼­ ¾Ë¾Æ º¸µµ·Ï ÇϰڽÀ´Ï´Ù. ÀÌ pageContext °´Ã¼°¡ »ý¼ºµÇ·Á¸é ¾Õ¿¡¼­ ¼³¸í µå¸° _jspxFactory °´Ã¼¸¦ »ç¿ëÇØ¾ß ÇÕ´Ï´Ù.

 

n        pageContext=_jspxFactory.getPageContext(this,request,response,¡°¡±,true,8192, true);

 

 pageContext´Â JspFactory Ŭ·¡½ºÀÇ getPageContext¸Þ¼­µåÀÇ ¹Ýȯ°ªÀ¸·Î ¾ò¾îÁö°Ô µË´Ï´Ù. À§¿¡¼­ º¸½Å´ë·Î getPageContext´Â ¸Å°³º¯¼ö¸¦ ¸¹ÀÌ ¿ä±¸ÇÕ´Ï´Ù. Àá±ñ »ìÆìº¸°í °¡º¸°Ú½À´Ï´Ù. getPageContextÀÇ ¿øÇüÀº ´ÙÀ½°ú °°½À´Ï´Ù.

 

JspFactoryÀÇ static ¸Þ¼­µå à getPageContext
PageContext getPageContext(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int buffer, boolean autoflush)

 
 ±×¸®°í À§ÀÇ ¿øÇü¿¡ °ªÀ» ³Ö¾î ¿¹¸¦ ¸¸µé¾îº¸¸é ¾Æ·¡¿Í °°½À´Ï´Ù.

 

getPageContext(this,request,response,¡°¡±,true,8192, true);

n        this à ¿äûÇÏ´Â ServletÀ» ÁöÁ¤(¿©±â¿¡¼­´Â ¹Ù·Î ÀÚ±â ÀÚ½ÅÀÌ ¿ä±¸ Çϱ⠶§¹®¿¡ this¸¦ »ç¿ëÇßÀ½)

n        request, response à _jspServiceÀÇ ¸Å°³º¯¼ö·Î µé¾î¿Â °Í

n         ¡°¡± à ¿¡·¯°¡ »ý°åÀ» °æ¿ì Ç¥½ÃÇÒ ¿¡·¯ ÆäÀÌÁöÀÇ URLÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ´Â °÷

n        true à JSP°¡ ¼¼¼ÇÀ» »ç¿ëÇÒ °ÍÀΰ¡ ¹°¾î º¸´Â °÷

n        8192 à Ŭ¶óÀÌ¾ðÆ®·Î Àü¼ÛÇÒ µ¥¾îÅÍÀÇ bufferÀÇ Å©±â¸¦ ÁöÁ¤ÇÏ´Â °÷

n        true à Ŭ¶óÀÌ¾ðÆ®·Î Àü¼ÛÇÒ µ¥¾îÅ͸¦ À§ÇÏ¿© autoflush¸¦ Áö¿øÇϴ°¡¸¦ ÁöÁ¤

 

 ÀÌ·¸°Ô ÇØ¼­ pageContextÀÇ °´Ã¼¸¦ »ý¼ºÇϸé ÀÌ °´Ã¼¸¦ »ç¿ëÇÏ¿© ´Ù¸¥ ³»À尴ü¸¦ »ý¼ºÇÏ°Ô µË´Ï´Ù. PageContext¸¦ ÀÌ¿ëÇÏ¿© »ý¼ºÇÒ ¼ö ÀÖ´Â °´Ã¼´Â ´ÙÀ½°ú °°½À´Ï´Ù.

 

PageContext¸¦ ÀÌ¿ëÇÏ¿© »ý¼ºÇÒ ¼ö ÀÖ´Â °´Ã¼

n        ServletContext application = pageContext.getServletContext();

n        ServletConfig config = pageContext.getServletConfig();

n        HttpSession session = pageContext.getSession();

n        JspWriter out = pageContext.getOut();

 

°á·ÐÀûÀ¸·Î, pageContext´Â PageContextÀÇ ¸Þ¼­µå¸¦ »ç¿ëÇÏ¿© ´Ù¸¥ ³»Àå °´Ã¼µéÀ» »ý¼ºÇϰí, ÃѰýÇÏ¸ç »ç¿ëÇÏ´Â °ÍÀÔ´Ï´Ù. JSP ÀÔÀå¿¡¼­ º»´Ù¸é °¡Àå Áß¿äÇÑ ³»Àå °´Ã¼¶ó°íµµ ÇÒ ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù.



jabookÀúÀÚ¸íÇÔ
Á¦¸ñ:¼Ò¼³°°ÀºJSP1ºÎ
ÀúÀÚ:ÃÖ¿µ°ü