Attributes bound into a session are available to any other servlet that belongs to the same ServletContext
Struts-config.xml:
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="ContactsActionForm"
type="firstStrutsApp.ContactsActionForm"/>
<form-bean name="ContactsSearchActionForm"
type="firstStrutsApp.ContactsSearchActionForm"/>
</form-beans>
<global-forwards>
<forward name="success"
path="/success.jsp"
redirect="false"/>
<forward name="searchResults"
path="/searchResults.jsp"
redirect="false"/>
</global-forwards>
<action-mappings>
<action path="/ContactsStoreAction"
type="firstStrutsApp.ContactsStoreAction"
name="ContactsActionForm"
scope="session"
input="/index.jsp">
<forward name="success"
path="/success.jsp"
redirect="false"/>
</action>
<action path="/ContactsSearchAction"
type="firstStrutsApp.ContactsSearchAction"
name="ContactsSearchActionForm"
scope="session"
input="/index.jsp">
<forward name="searchResults"
path="/searchResults.jsp"
redirect="false"/>
</action>
</action-mappings>
<message-resources parameter="<b>firstStrutsApp.ApplicationResources</b>"/>
</struts-config>
index.jsp
---------
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<html:html>
<head>
<title>
<bean:message key="<b>strutsApp.title</b>"/>
</title>
<body>
<h1><bean:message key="strutsApp.heading"/></h1>
<html:form action="ContactsStoreAction.do" focus="contactName">
<table>
<tr>
<td>
<bean:message key="strutsApp.contactName"/>
</td>
<td>
<html:text property="contactName" size="20"/>
</td>
<td>
<html:errors property="contactName"/>
</td>
</tr>
<tr>
<td>
<bean:message key="strutsApp.contactNumber"/>
</td>
<td>
<html:text property="contactNumber" size="20"/>
</td>
<td>
<html:errors property="contactNumber"/>
</td>
</tr>
<tr>
<td>
<bean:message key="strutsApp.contactCountry"/>
</td>
<td>
<html:text property="contactCountry" size="20"/>
</td>
<td>
<html:errors property="contactCountry"/>
</td>
</tr>
</table>
<html:submit>
<bean:message key="strutsApp.submit"/>
</html:submit>
<html:reset>
<bean:message key="strutsApp.reset"/>
</html:reset>
</html:form>
</body>
</html:html>