Struts 2デバッグタグの例

Struts 2デバッグタグの例

ダウンロード–Struts2-Debug-Tag-Example.zip

Struts 2では、「debug」タグは、「Value Stack」のコンテンツと「Stack Context」の詳細をWebページに出力するための非常に便利なデバッグタグです。 このチュートリアルでは、JSPページでの「debug」タグの使用法を示します。

1. アクション

propertyInStack」プロパティを持つ単純なActionクラスは、後で値スタックに表示されます。

DebugTagAction.java

package com.example.common.action;

import com.opensymphony.xwork2.ActionSupport;

public class DebugTagAction extends ActionSupport{

    public String propertyInStack;

    public String getPropertyInStack() {
        return propertyInStack;
    }

    public void setPropertyInStack(String propertyInStack) {
        this.propertyInStack = propertyInStack;
    }

}

2. 日付タグの例

システムの「Value Stack」および「Stack Context」を出力するための「debug」タグの使用を示すJSPページ。

debug.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>
 




Struts 2 debug tag example

<s:debug />は、「debug」という名前のテキストリンクを生成します。デバッグの詳細を展開するには、テキストリンクをクリックする必要があります。

3. struts.xml

リンクしてください〜




    
    

        
            pages/debug.jsp