Home Struts Struts Struts2.2.1 Tags struts2.2.1 include tag example.

Ask Questions?

View Latest Questions


 
 

struts2.2.1 include tag example.
Posted on: January 6, 2011 at 12:00 AM
Advertisement
In this example, you will see the use of include tag of struts2.2.1.

struts2.2.1 include tag example.

In this example, you will see the use of include tag of struts2.2.1. It is a generic tag that is used to include the output of  html or jsp pages directly into current page or we can include output of another web resource into current page.

Directory structure of include tag example.

 1- index.jsp  

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

<html>

<head><title>Struts2.2.1_Include_tag_Example</title></head>

<body>

<h2>Struts2.2.1_Include_tag_Example</h2>

<hr><s:a href="include.action">Include page</s:a>

<hr><s:a href="IncludeTagAction.action">Result page</s:a>

</body>

</html> 

2-IncludeTagAction.java

package roseindia.action;

import com.opensymphony.xwork2.ActionSupport;

public class IncludeTagAction extends ActionSupport{

private static final long serialVersionUID = 1L;

public String execute() {

return SUCCESS;}

}

3-include.jsp

<html>

<head><title>Struts2.2.1_Include_tag_Example</title>

<style type="text/css">

.b{color: graytext;} font{color: green;}

</style></head>

<body><h2 class="b">Struts2.2.1_Include_tag_Example</h2>

<hr class="b">

<font>Bharat singh<br/> Roseindia Technology </font>

</body>

</html>

4_struts.xml

<struts>

<package name="roseindia" extends="struts-default" namespace="/">

<action name="IncludeTagAction" class="roseindia.action.IncludeTagAction">

<result>jsp/result.jsp</result>

</action>

<action name="include" >

<result>jsp/include.jsp</result>

</action>

</package>

</struts>

5_result.jsp

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

<html>

<head><title>Struts2.2.1_Include_tag_Example</title>

</head>

<body><h2>Struts2.2.1_Include_tag_Example</h2>

<hr><h3>Value of include.jsp page</h3>

<s:include value="/jsp/include.jsp"></s:include>

</body>

</html>

 

index.jsp

include.jsp

result.jsp

Download Select Source Code


Related Tags for struts2.2.1 include tag example.:


DMCA.com