The Jakarta Project < Velocity Tools - Struts >

Velocity Tools

VelocityStruts

VelocityStruts Tools

その他のサブプロジェクト

StrutsLinkTool リファレンスドキュメント
       

The StrutsLinkTool extends the standard LinkTool to add methods for working with Struts' Actions and Forwards:

StrutsLinkTool は LinkTool を拡張し、 Struts の Action と Forward に関する処理を行うメソッドを追加したものです:

  • (Struts の Forward, Action の) 論理名を URI リファレンスに 変換します。メソッド setAction()setForward() を参照してください。
Class
 org.apache.velocity.tools.struts.StrutsLinkTool
Name
 $link (Velocityコンテキスト内での推奨名)
Toolbox設定例
 
<tool>
  <key>link</key>
  <scope>request</scope>
  <class>org.apache.velocity.tools.struts.StrutsLinkTool</class>
</tool>
作者
 Gabriel Sidler
Nathan Bubna
Method Overview
setAction() Returns a copy of this StrutsLinkTool instance with the given action path converted into a server-relative URI reference.
setForward() Returns a copy of this StrutsLinkTool instance with the given global forward name converted into a server-relative URI reference.
Method Overview
setAction() 指定したアクションパスをサーバ相対 URI リファレンスへ変換し、 この StrutsLinkTool のインスタンスのコピーへ設定して返却します。
setForward() 指定したグローバルフォワード名をサーバ相対 URI リファレンスへ変換し、 この StrutsLinkTool のインスタンスのコピーへ設定して返却します。
setAction()
       

Returns a copy of this StrutsLinkTool instance with the given action path converted into a server-relative URI reference.

StrutsLinkTool setAction(String action)

Parameters
action
An action path as defined in struts-config.xml, e.g. /logon.
Returns
A new instance of StrutsLinkTool.

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.

## a form tag
<form name="form1" action="$link.setAction("demo")">

Produces something like:

<form name="form1" action="/myapp/demo.do">

指定したアクションパスをサーバ相対 URI リファレンスへ変換し、 この StrutsLinkTool のインスタンスのコピーへ設定して返却します。

StrutsLinkTool setAction(String action)

Parameters
action
struts-config.xml で定義されているアクションパス。例: /logon
Returns
StrutsLinkTool の新しいインスタンス。

アクション名はサーバ相対 URI リファレンスへ変換されます。 このメソッドはアクションが定義されているかどうかのチェックは行いません。 このメソッドは前に設定されていた URI リファレンスを上書きしますが、 クエリデータはコピーされます。

## フォームタグ
<form name="form1" action="$link.setAction("demo")">

以下のような出力になります:

<form name="form1" action="/myapp/demo.do">

setForward()
       

Returns a copy of this StrutsLinkTool instance with the given global forward name converted into a server-relative URI reference.

StrutsLinkTool setForward(String forward)

Parameters
forward
The name of a global forward as defined in struts-config.xml.
Returns
A new instance of StrutsLinkTool or null if the parameter does not map to a valid forward.

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.

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

Produces something like:

<a href="/myapp/templates/index.vm?key=val+1">My Link</a>

指定したグローバルフォワード名をサーバ相対 URI リファレンスへ変換し、 この StrutsLinkTool のインスタンスのコピーへ設定して返却します。

StrutsLinkTool setForward(String forward)

Parameters
forward
struts-config.xml に定義されているグローバルフォワード名。
Returns
StrutsLinkTool の新しいインスタンス。 引数がフォワードのマッピングに見つからなかった場合は null

グローバルフォワード名はサーバ相対 URI リファレンスへ変換されます。 このメソッドは前に設定されていた URI リファレンスを上書きしますが、 クエリデータはコピーされます。

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

以下のような出力になります:

<a href="/myapp/templates/index.vm?key=val+1">My Link</a>


[訳注: この文書は 木村 貴由 高橋 達男 が翻訳しました。 日本語訳に対するコメントがあれば、report@jajakarta.orgに送って下さい。]
Copyright © 1999-2003, Apache Software Foundation