<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFABORT</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFABORT</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
このタグの位置で ColdFusion ページの処理を停止します。ColdFusion によって、このタグの前に処理されたすべての内容が返されます。このタグはしばしば条件論理式と共に使用され、ある条件が発生した場合にページの処理を停止します。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">カテゴリ</span>
<p>
フロー制御タグ
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;cfabort
   showError = &quot;error_message&quot;&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
cfbreak、cfexecute、cfexit、cfif、cflocation、cfloop、cfswitch、cfthrow、cftry、『ColdFusion MX 開発ガイド』の第2章の「CFML の要素」 の「cfabort と cfexit」
</p>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">使用方法</span>
<p>
cfabort タグと cferror タグを共に使用すると、cfabort タグによりすぐに処理が停止され、cferror タグにより指定されたページに出力がリダイレクトされます。 
</p>

<p>
このタグに showError 属性値が含まれない場合、タグに到達すると処理はすぐに停止され、ColdFusion により cfabort タグを含む行までのページコンテンツが返されます。
</p>

<p>
このタグを showError 属性と共に使用する一方で、cferror タグを使用してエラーページを定義しなかった場合は、cfabort タグに到達したときにページ処理が停止されます。また、showError 内のメッセージがクライアントに表示されます。
</p>

<p>
このタグを showError 属性と共に使用し、同時に cferror を使用してエラーページを定義すると、cferror タグで指定されたエラーページに出力がリダイレクトされます。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span>
<p>
この例は、処理を停止するための cfabort の使用方法を示します。cfabort が使用されている 2 番めの例では、結果が表示されません。
</p>
<pre>&lt;h3&gt;例 A: 命令を自動的に完了させます。&lt;/h3&gt;
&lt;!--- 最初に変数を設定 ---&gt;
&lt;cfset myVariable = 3&gt;
&lt;!--- ここで、この値を増分するためのループを実行 ---&gt;
&lt;cfloop from = &quot;1&quot; to = &quot;4&quot; index = &quot;Counter&quot;&gt;
   &lt;cfset myVariable = myVariable + 1&gt;
&lt;/cfloop&gt;

&lt;cfoutput&gt;
&lt;p&gt;   #Counter# 回のループで myVariable 変数の値を増分した結果 : 
#myVariable#
&lt;/cfoutput&gt;

&lt;h3&gt;例 B: cfabort を使用して、showmessage 属性および cferror を使用する命令を停止します。&lt;/h3&gt;
&lt;!--- 変数をリセットし、cfabort が使用されたことを示します。 ---&gt;
&lt;cfset myVariable = 3&gt;
&lt;!--- ここで、この値を増分するためのループを実行 ---&gt;
&lt;cfloop from = &quot;1&quot; to = &quot;4&quot; index = &quot;Counter&quot;&gt;
&lt;!--- 2 回めのループで cfabort に到達 ---&gt;
   &lt;cfif Counter is 2&gt;
   &lt;!--- cferror 行を取り出し、CF エラーメッセージで処理された cfabort エラーを確認 ---&gt;
      &lt;cferror type=&quot;request&quot; template=&quot;request_err.cfm&quot;&gt;
      &lt;cfabort showerror=&quot;CFABORT は不適切な理由で呼び出されました。&quot;&gt;
&lt;!--- 処理が停止し、後続のオペレーションは行われません。---&gt;
   &lt;cfelse&gt;
      &lt;cfset myVariable = myVariable + 1&gt;
   &lt;/cfif&gt; 
&lt;/cfloop&gt;

&lt;cfoutput&gt;
&lt;p&gt;#Counter# 回のループで myVariable 変数の値を増分した結果 : #myVariable#
&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="SHOWERROR">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SHOWERROR</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>タグの実行時に、標準の ColdFusion エラーページに表示するエラーです。</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
