Struts 2のincludeタグの例

Struts 2インクルードタグの例

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

Struts 2の「include」タグは、JSPまたはHTMLページを現在のページに直接含めるために使用されます。 「include」タグのデモンストレーションについては、以下の例を参照してください。

1. アクション

転送タスクのみを実行する単純なActionクラス。

IncludeTagAction.java

package com.example.common.action;

import com.opensymphony.xwork2.ActionSupport;

public class IncludeTagAction extends ActionSupport{

    public String execute() throws Exception {

        return SUCCESS;
    }
}

2. タグの例を含める

これは、includeタグを使用して、現在のページ「include.jsp」に「example.jsp」ページを含めることを示しています。

include.jsp

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





Struts 2 include tag example

example.jsp






Message from example.jsp

3. struts.xml

リンクしてください〜




    
    

        
            pages/include.jsp