Struts2.2.1 updownselect Tag Example
Posted on: January 17, 2011 at 12:00 AM
The updownselect tag is a UI tag that creates a HTML select component with buttons to move up and down the elements in the select component.

Struts2.2.1 updownselect Tag Example

The updownselect tag is a UI tag that creates a HTML select component with buttons to move up and down the elements in the select component. When the containing form is submitted, its elements will be submitted in the order they are arranged (top to bottom).

The following Example will shows how to implement the updownselect tag in the Struts2.2.1 --

First we create a JSP file named UpDownSelectTag.jsp as follows.

<%@ page language="java" contentType="text/html; charset=UTF-8"


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"


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



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>UpdownSelect Tag Example</title>



UpdownSelect Tag Example

<s:form action="ResultUpDownSelect">


list="#{'Fun Cinema':'Fun Cinema','PVR':'PVR','WAVE':'WAVE'


name="favMultiplex" headerKey="-1" headerValue="--- Please Select ---"

size="4" />


list="#{'Titanic':'Titanic','300':'300','Van Helsing':'Van Helsing',

'Lagaan':'Lagaan','3 Idiot':'3 Idiot'}"

name="favMovies" headerKey="-1" headerValue="--- Please Select ---"

size="4" />





The Struts mapping file Struts.xml is as follows-

<?xml version="1.0" encoding="UTF-8"?>


"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"



<constant name="struts.enable.DynamicMethodInvocation" value="false" />

<constant name="struts.devMode" value="false" />

<constant name="struts.custom.i18n.resources" value="ApplicationResources" />

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

<action name="UpDownSelectTag" class="roseindia.UpDownSelectTag"


<result name="none">/UpDownSelectTag.jsp</result>


<action name="ResultUpDownSelect" class="roseindia.UpDownSelectTag">

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




The action class is as follows.

package roseindia;

import com.opensymphony.xwork2.ActionSupport;

public class UpDownSelectTag extends ActionSupport {

private String favMovies;

private String favMultiplex;

public String execute() throws Exception {

return SUCCESS;


public String getFavMultiplex() {

return favMultiplex;


public void setFavMultiplex(String favMultiplex) {

this.favMultiplex = favMultiplex;


public String getFavMovies() {

return favMovies;


public void setFavMovies(String favMovies) {

this.favMovies = favMovies;


public String display() {

return NONE;



This Program produces output on the basis of the UpDownSelect Tag  evaluation, This  give the output as-


Download Select Source Code

Related Tags for Struts2.2.1 updownselect Tag Example:




Advertisement null