<?xml version="1.0" encoding="Shift_JIS"?>
<!--
  Copyright 2003-2004 The Apache Software Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  $Id: StrutsLinkTool.xml,v 1.5 2005/03/20 13:30:24 tatakaha Exp $
-->
<document>

    <properties>
        <title>StrutsLinkTool</title>
        <author email="sidler@apache.org">Gabriel Sidler</author>
        <translator email="nekop@programmers.jp">木村 貴由</translator>
        <translator email="tatakaha@jajakarta.org">高橋 達男</translator>
        <projectfile>xdocs-ja/struts/menu.xml</projectfile>
        <original>StrutsLinkTool</original>
     </properties>

    <body>

    <section name="StrutsLinkTool Reference Documentation" alias="StrutsLinkTool リファレンスドキュメント">

        <primary>
        <p>The StrutsLinkTool extends the standard 
        <a href="../view/LinkTool.html">LinkTool</a> to add methods 
        for working with Struts' Actions and Forwards:</p>
        </primary>
        <p>StrutsLinkTool は <a href="../view/LinkTool.html">LinkTool</a>
        を拡張し、 Struts の Action と Forward に関する処理を行うメソッドを追加したものです:</p>
        <primary>
        <ul>
            <li>translate logical names (Struts forwards, actions ) to URI references, see
              methods <a href="#setAction()">setAction()</a> and <a href="#setForward()">
              setForward()</a></li>
        </ul>
        </primary>
        <ul>
            <li>(Struts の Forward, Action の) 論理名を URI リファレンスに
            変換します。メソッド <a href="#setAction()">setAction()</a> と
            <a href="#setForward()">setForward()</a> を参照してください。</li>
        </ul>
        
        <toolinfo>
            <version>@@@version@@@, @@@date@@@</version>
            <clazz>org.apache.velocity.tools.struts.StrutsLinkTool</clazz>
            <name>$link</name>
            <author email="sidler@teamup.com">Gabriel Sidler</author>
            <author email="nathan@esha.com">Nathan Bubna</author>
            <config-example>&lt;tool&gt;
  &lt;key&gt;link&lt;/key&gt;
  &lt;scope&gt;request&lt;/scope&gt;
  &lt;class&gt;org.apache.velocity.tools.struts.StrutsLinkTool&lt;/class&gt;
&lt;/tool&gt;</config-example>
        </toolinfo>

        <methods/>

    </section>

    <section name="setAction()">
        <primary>
        <method name="setAction()">
    
            <abstract>
                Returns a copy of this StrutsLinkTool instance with the given action path
                converted into a server-relative URI reference.
            </abstract>
    
            <signature>
                StrutsLinkTool setAction(String action)
            </signature>
            
            <parameters>
                <parameter name="action">
                    An action path as defined in struts-config.xml, e.g. <code>/logon</code>.
                </parameter>
            </parameters>
    
            <returns>
                A new instance of <code>StrutsLinkTool</code>.  
            </returns>
    
            <description>
                <p>The action name is translated into a server-relative URI reference. The method does 
                not check if the specified action has been defined. It will overwrite any 
                previously set URI reference but will copy the query string.</p>
            </description>

<sourcecode>## a form tag
&lt;form name="form1" action="$link.setAction("demo")"&gt;</sourcecode>

<p>Produces something like:</p>

<sourcecode>&lt;form name="form1" action="/myapp/demo.do"&gt;</sourcecode>
    
        </method>
        </primary>
        <method name="setAction()">
    
            <abstract>
                指定したアクションパスをサーバ相対 URI リファレンスへ変換し、
                この StrutsLinkTool のインスタンスのコピーへ設定して返却します。
            </abstract>
    
            <signature>
                StrutsLinkTool setAction(String action)
            </signature>
            
            <parameters>
                <parameter name="action">
                    struts-config.xml で定義されているアクションパス。例: <code>/logon</code>。
                </parameter>
            </parameters>
    
            <returns>
                <code>StrutsLinkTool</code> の新しいインスタンス。
            </returns>
    
            <description>
                <p>アクション名はサーバ相対 URI リファレンスへ変換されます。
                このメソッドはアクションが定義されているかどうかのチェックは行いません。
                このメソッドは前に設定されていた URI リファレンスを上書きしますが、
                クエリデータはコピーされます。</p>
            </description>

<sourcecode>## フォームタグ
&lt;form name="form1" action="$link.setAction("demo")"&gt;</sourcecode>

<p>以下のような出力になります:</p>

<sourcecode>&lt;form name="form1" action="/myapp/demo.do"&gt;</sourcecode>
    
        </method>
    </section>


    <section name="setForward()">
        <primary>
        <method name="setForward()">
    
            <abstract>
                Returns a copy of this StrutsLinkTool instance with the given global 
                forward name converted into a server-relative URI reference.
            </abstract>
    
            <signature>
                StrutsLinkTool setForward(String forward)
            </signature>
            
            <parameters>
                <parameter name="forward">
                    The name of a global forward as defined in struts-config.xml.
                </parameter>
            </parameters>
    
            <returns>
                A new instance of <code>StrutsLinkTool</code> or <code>null</code> if the 
                parameter does not map to a valid forward.
            </returns>
    
            <description>
                <p>The global forward name is translated into a server-relative 
                URI reference. This method will overwrite any previously set URI 
                reference but will copy the query string.</p>
            </description>

<sourcecode>## a forward
&lt;a href="$link.setForward("start").addQueryData("key1","val 1")"&gt;
My Link&lt;/a&gt;</sourcecode>

<p>Produces something like:</p>

<sourcecode>&lt;a href="/myapp/templates/index.vm?key=val+1"&gt;My Link&lt;/a&gt;</sourcecode>

    
        </method>
        </primary>
        <method name="setForward()">
    
            <abstract>
                指定したグローバルフォワード名をサーバ相対 URI リファレンスへ変換し、
                この StrutsLinkTool のインスタンスのコピーへ設定して返却します。
            </abstract>
    
            <signature>
                StrutsLinkTool setForward(String forward)
            </signature>
            
            <parameters>
                <parameter name="forward">
                    struts-config.xml に定義されているグローバルフォワード名。
                </parameter>
            </parameters>
    
            <returns>
                <code>StrutsLinkTool</code> の新しいインスタンス。
                引数がフォワードのマッピングに見つからなかった場合は <code>null</code> 。
            </returns>
    
            <description>
                <p>グローバルフォワード名はサーバ相対 URI リファレンスへ変換されます。
                このメソッドは前に設定されていた URI リファレンスを上書きしますが、
                クエリデータはコピーされます。</p>
            </description>

<sourcecode>## フォワード
&lt;a href="$link.setForward("start").addQueryData("key1","val 1")"&gt;
My Link&lt;/a&gt;</sourcecode>

<p>以下のような出力になります:</p>

<sourcecode>&lt;a href="/myapp/templates/index.vm?key=val+1"&gt;My Link&lt;/a&gt;</sourcecode>

    
        </method>
    </section>

 </body>
</document>

