javax.servlet.jsp.tagext
ÀÎÅÍÆäÀ̽º TryCatchFinally


public interface TryCatchFinally

Tag, IterationTag, ¶Ç´Â BodyTag ÅÂ±× Çڵ鷯ÀÇ º¸Á¶ ÀÎÅÍÆäÀ̽ºÀÔ´Ï´Ù. ¸®¼Ò½º¸¦ °ü¸®ÇÏ´Â ÈÅÀ» Ãß°¡ÇÒ °æ¿ì¿¡ »ç¿ëÇÕ´Ï´Ù.

ÀÌ ÀÎÅÍÆäÀ̽º¿¡´Â, doCatch(Throwable) ¹× doFinally()¶ó°í ÇÏ´Â, 2 °³(»ì)ÀÇ »õ·Î¿î ¸Þ¼Òµå°¡ ÁغñµÇ¾î ÀÖ½À´Ï´Ù. Ç¥ÁØÀûÀΠȣÃâÇØ ¹æ¹ýÀº, ´ÙÀ½°ú °°½À´Ï´Ù.

 h = get a Tag();  // get a tag handler, perhaps from pool

 h.setPageContext(pc);  // initialize as desired
 h.setParent(null);
 h.setFoo("foo");
 
 // tag invocation protocol; see Tag.java
 try {
   doStartTag()...
   ....
   doEndTag()...
 } catch (Throwable t) {
   // react to exceptional condition
   h.doCatch(t);
 } finally {
   // restore data invariants and release per-invocation resources
   h.doFinally();
 }
 
 ... other invocations perhaps with some new setters
 ...
 h.release();  // release long-term resources
 


¸Þ¼ÒµåÀÇ °³¿ä
 void doCatch (java.lang.Throwable t)
          Å±×ÀÇ ³»ºÎ¿¡¼­ BODY ¸¦ Æò°¡Çϰí ÀÖÀ» ¶§ Throwable °¡ ¹ß»ýÇßÀ» °æ¿ì, ¶Ç´Â Tag.doStartTag(), Tag.doEndTag(), IterationTag.doAfterBody(), ¹× BodyTag.doInitBody() ¸Þ¼Òµå³»¿¡¼­ Throwable °¡ ¹ß»ýÇßÀ» °æ¿ì¿¡ ºÒ·Á °©´Ï´Ù.
 void doFinally ()
          Tag, IterationTag, ¶Ç´Â BodyTag ¸¦ ½ÇÀåÇϰí Àִ Ŭ·¡½ºÀÇ doEndTag() °¡ Á¾·áµÇ¾úÀ» ¶§¿¡, ¹Ýµå½Ã ºÒ·Á °©´Ï´Ù.
 

¸Þ¼ÒµåÀÇ »ó¼¼

doCatch

public void doCatch(java.lang.Throwable t)
             throws java.lang.Throwable
ű×ÀÇ ³»ºÎ¿¡¼­ BODY ¸¦ Æò°¡Çϰí ÀÖÀ» ¶§ Throwable °¡ ¹ß»ýÇßÀ» °æ¿ì, ¶Ç´Â Tag.doStartTag(), Tag.doEndTag(), IterationTag.doAfterBody(), ¹× BodyTag.doInitBody() ¸Þ¼Òµå³»¿¡¼­ Throwable °¡ ¹ß»ýÇßÀ» °æ¿ì¿¡ ºÒ·Á °©´Ï´Ù.

ÀÌ ¸Þ¼Òµå´Â, ¼³Á¤ ¸Þ¼ÒµåÀÇ ½ÇÇàÁß¿¡ Throwable °¡ ¹ß»ýÇØµµ, ºÒ·Á °¡Áö ¾Ê½À´Ï´Ù.

ÀÌ ¸Þ¼Òµå´Â ijġ ÇÑ ¿¹¿Ü ȤÀº »õ·Î¿î ¿¹¿Ü¸¦ ½½·Î¿ì ÇÒ ¼ö°¡ ÀÖ½À´Ï´Ù. ½½·Î¿ì µÈ ¿¹¿Ü´Â, »óÀÚ °èÃþÀ» ÀüÆÄ ÇÕ´Ï´Ù. ¿¹¿Ü°¡ ½½·Î¿ì µÇ¸é(ÀÚ), doFinally()°¡ ºÒ·Á °©´Ï´Ù.

ÀÌ ¸Þ¼Òµå´Â, ¿¹¿Ü Á¶°Ç¿¡ ÀÀ´äÇÒ °æ¿ì¿¡ »ç¿ëÇÕ´Ï´Ù.

ÆÄ¶ó¹ÌÅÍ:
t - ÀÌ Å±׸¦ ó¸®ÇÒ ¶§¿¡ ¹ß»ýÇÏ´Â, Throwable ÇüÀÇ ¿¹¿Ü

doFinally

public void doFinally()
Tag, IterationTag, ¶Ç´Â BodyTag ¸¦ ½ÇÀåÇϰí Àִ Ŭ·¡½ºÀÇ doEndTag() °¡ Á¾·áµÇ¾úÀ» ¶§¿¡, ¹Ýµå½Ã ºÒ·Á °©´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â, ű×ÀÇ BODY ³»¿¡¼­ ¿¹¿Ü°¡ ¹ß»ýÇßÀ» °æ¿ì³ª, Tag.doStartTag(), Tag.doEndTag(), IterationTag.doAfterBody(), ¹× BodyTag.doInitBody() ¸Þ¼Òµå·Î ¿¹¿Ü°¡ ¹ß»ýÇßÀ» °æ¿ì¿¡¼­µµ ºÒ·Á °©´Ï´Ù.

ÀÌ ¸Þ¼Òµå´Â, ¼³Á¤ ¸Þ¼ÒµåÀÇ ½ÇÇàÁß¿¡ Throwable °¡ ¹ß»ýÇØµµ, ºÒ·Á °¡Áö ¾Ê½À´Ï´Ù.

ÀÌ ¸Þ¼Òµå´Â ¿¹¿Ü¸¦ ½½·Î¿ì ÇÏÁö ¾Ê½À´Ï´Ù.

ÀÌ ¸Þ¼Òµå´Â, È£ÃâÇÒ °ÍÀÇ µ¥ÀÌÅÍÀÇ Á¤ÇÕ¼º ¹× ¸®¼Ò½º °ü¸®¸¦ À§ÇÑ Ã³¸®ÀÇ Á¤ÇÕ¼ºÀ» È®º¸Çϱâ À§Çؼ­ »ç¿ëµË´Ï´Ù.



Copyright 2002 Sun Microsystems, Inc. All rights reserved.
»ç¿ë¿¡´Â»ç¿ë Çã¶ô °è¾àÀÌ Àû¿ëµË´Ï´Ù.