Home Struts Struts Struts2.2.1 Tags Example of push tag in struts2.2.1

Ask Questions?

View Latest Questions


Example of push tag in struts2.2.1
Posted on: January 7, 2011 at 12:00 AM
in this section, you will see the example of push tag of struts2.2.1.

Example of push tag in struts2.2.1

In this example, you will see the use of push tag of struts2.2.1 framework. The push tag push a value onto the to of stack. So it can access easily by using first-level of OGNL expression language.. 

Directory structure of push tag example.

 1- index.jsp  

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





<hr>Hello<s:a href="PushAction.action">pushAction</s:a>




package roseindia.action;

import com.opensymphony.xwork2.ActionSupport;

public class PushTagAction extends ActionSupport {

public String execute() {

return SUCCESS;}



package roseindia.bean;

public class EmployeeBean {

private String emp_name ="Bharat";

private String address="Bareilly";

public String getEmp_name() {

return emp_name;}

public void setEmp_name(String empName) {

emp_name = empName;}

public String getAddress() {

return address;}

public void setAddress(String address) {

this.address = address;}




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

<action name="PushAction" class="roseindia.action.PushTagAction">

<result name="success">pushResult.jsp</result>







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


<STYLE type="text/css">




<hr/><b>Simple </b><br/><br/>

<s:bean name="roseindia.bean.EmployeeBean" var="empBean">

Name : <s:property value="#empBean.emp_name"/><br/>

Address : <s:property value="#empBean.address"/>


<hr/><b>Using push tag</b><br/><br/>

<s:push value="#empBean">

Name : <s:property value="emp_name"/><br/>

Address : <s:property value="address"/>







Download Select Source Code

Related Tags for Example of push tag in struts2.2.1: