Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
I'll talk about the Param Tag. To set the values of the variables in other tags, such as include and bean, struts use the param tag. Other tags are parametrized using it. Struts' param tag is used with other tags to set parameter values in addition to the bean tag.
About Struts 2 Param Tag
Other tags may be parameterized using this tag. A name may or may not be used as the key when adding parameters. The value can be specified in a value attribute or as text between the start and end tags when we declare the param tag. In these two scenarios, Struts acts quite differently.
These are the two criteria for this tag.
Name (String): The parameter's name
value (Object): The parameter's value
The example that follows demonstrates how to use the ParamTag in Struts2 is below.
Creating Action Class
package com.codingninjas.struts2;
public class ActionClass {
private String name;
// Exception view
public String execute() throws Exception {
return "success";
}
// Getting the name in the string
public String getName() {
return name;
}
// Setting the name in the string
public void setName(String name) {
this.name = name;
}
}
Create Views
Let's have Action.jsp with the material listed below.
/* Page view utf scaling tag*/
<%@ page contentType = "text/html; charset = UTF-8" %>
/* Prefix tags*/
<%@ taglib prefix = "s" uri = "/struts-tags" %>
<html>
<head>
<title>Hello Param tag</title>
</head>
<body>
// Assign the name and variable.
<s:bean name = "org.apache.struts2.util.Counter" var = "counter">
// Assigning the first value
<s:param name = "first" value = "20"/>
// Assigning the last value
<s:param name = "last" value = "25" />
</s:bean>
// Unordered list
<ul>
<s:iterator value = "#counter">
<li><s:property /></li>
</s:iterator>
</ul>
</body>
</html>
The code of employees.jsp should then be as follows:
/* page view utf scaling tag*/
<%@ page contentType = "text/html; charset = UTF-8"%>
/* prefix tags*/
<%@ taglib prefix = "s" uri = "/struts-tags"%>
<html>
<head>
<title>Employees</title>
</head>
<body>
<p>An illustration of an include tag is: </p>
<s:include value = "Action.jsp"/>
</body>
</html>
Configuration Files
Code of struts.xml should look like −
// Version of xml
<?xml version = "1.0" Encoding = "UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name = "struts.devMode" value = "true" />
<package name = "helloworld" extends = "struts-default">
<action name = "hello"
class = "com.codingninja.struts2.ActionClass"
method = "execute">
// Attaching jsp file
<result name = "success">/Action.jsp</result>
</action>
<action name = "employee"
class = "com.codingninjas.struts2.Employee"
method = "execute">
// Jsp file attachment
<result name = "success">/employee.jsp</result>
</action>
</package>
</struts>
Your web.xml should appear as follows:
// Xml version
<?xml version = "1.0" Encoding = "UTF-8"?>
// All different xmlns, web, locations etc
<web-app xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns = "http://java.sun.com/xml/ns/javaee"
xmlns:web = "http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation = "http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id = "WebApp_ID" version = "3.0">
<display-name>Struts 2</display-name>
// Index file attachment
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
// Dispatcher
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
// Pattern
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Output
Frequently Asked Questions
What does HTML's param name mean?
The name of a "param" element is specified via the name attribute. To set parameters for the plugin given with the object> tag, the name attribute is utilized in conjunction with the value attribute. Any name the provided object supports may be used as the name attribute value.
How is the param tag used in an APPLET?
The applet code accesses the parameter value supplied in the value attribute by using the name assigned to the param tag's name attribute as a variable. By doing this, the applet may communicate with the HTML page where it is embedded and utilize any run-time values that are given to it by the page.
How are HTML tags used?
A particular word or letter enclosed in angle brackets, and >, is known as an HTML tag. HTML elements, such as paragraphs or links, are created using tags. A lot of factors contain starting and closing tags, such as the p (paragraph) component, which has an opening <p> tag, the paragraph text, and a closing </p> tag.
What is Web Framework?
It is a software framework, also known as a web application framework (WAF), which helps create web applications, including web APIs, web services, and web resources.
What does struts XML's param name mean?
To modify the properties of the configuration objects, use the param tag in the struts.xml file. Due to the fact that it is a JSP tag, the s: param tag is unique. Other JSP tags that have the ability to supply arguments can be parametrized using it.
What does the Java param tag do?
A Java applet that is embedded in a document with the APPLET element uses the PARAM element to receive "command-line" parameters. It has two attributes: NAME, which describes the argument's name, and VALUE, which specifies the argument's value.
In this article, we discussed Param Tag. Check different frameworks. We are creating a brand-new instance of the bean called org.apache.struts2.util.Counter. Then, we set the first and last properties to 20 and 25, respectively.
The counter will therefore have the values 20, 21, 22, 23, 24, and 25. The bean is given the moniker "counter." The bean is created and added to the value stack by the struts bean tag. Now that we have the iterator, we can use it to loop through the Counter bean and output its value.
To learn about various Java frameworks, click here. See the official website for documentation and other information about Struts.
Nevertheless, you may consider our paid courses to give your career an edge over others.
Do upvote our blogs if you find them helpful and engaging!
Happy Learning!
Live masterclass
Beginner to GenAI Engineer Roadmap for 30L+ CTC at Amazon
by Shantanu Shubham
23 Feb, 2026
03:00 PM
Zero to Data Analyst: Amazon Analyst Roadmap for 30L+ CTC
by Abhishek Soni
22 Feb, 2026
06:30 AM
Top GenAI Skills to crack 30 LPA+ roles at Amazon & Google
by Sumit Shukla
22 Feb, 2026
08:30 AM
Data Analysis for 20L+ CTC@Flipkart: End-Season Sales dataset
by Sumit Shukla
23 Feb, 2026
01:30 PM
Beginner to GenAI Engineer Roadmap for 30L+ CTC at Amazon
by Shantanu Shubham
23 Feb, 2026
03:00 PM
Zero to Data Analyst: Amazon Analyst Roadmap for 30L+ CTC