Struts2 Include Tag Example
Aim:
The include tag is used to include servlet or jsp into the current page.
Procedure:
Step 1:
Create Project as IncludePro
Step 2:
Create Action as IncludeAction.java
package example;
import com.opensymphony.xwork2.ActionSupport;
public class IncludeAction extends ActionSupport
{
public IncludeAction()
{
}
public String execute() throws Exception
{
return "success";
}
}
Step 3:
Create jsp file
1). home.jsp
< %@taglib uri="/struts-tags" prefix="s" % >
< html >
< head >
< title > home JSP Page < /title >
< /head >
< body >
< s:form action="includeAction" >
< s:submit/ >
< /s:form >
< /body >
< /html >
2). success.jsp
< %@taglib uri="/struts-tags" prefix="s" % >
< html >
< head >
< title > success JSP Page < /title >
< /head >
< body >
< s:include value="display.jsp"/ >
< /body >
< /html >
3). display.jsp
< %@taglib uri="/struts-tags" prefix="s" % >
< html >
< head >
< title > success JSP Page < /title >
< /head >
< body >
SureshKumar.,M.Sc,M.Phil.,
< /body >
< /html >
No comments:
Post a Comment