I have two JSP pages displaying two lists from two different actions: page A
displays employee list, page B
displays department list.
Both pages have a common text field (included from a third JSP page) on the top to search employees by name:
<s:form action="searchEmployeesByName">
<s:textfield name="employeeName" />
<s:submit>
</s:form>
The search action is a part of class EmployeeAction
and I can load page A
and perform searching without problems. However, when loading page B
, I encountered ognl.NoSuchPropertyException
because property employeeName
is not on the ValueStack
of DepartmentAction
.
How can I solve this problem? Are there any ways to access employeeName
of EmployeeAction
from DepartmentAction
? Or how should I reorganize my actions to perform the common search functionality?
Here is my action configuration file:
<struts>
<package name="employee" namespace="/employee" extends="tiles-default">
<action name="getEmployeeList" class="my.package.EmployeeAction"
method="getEmployeeList">
<result name="success">/employee_list.tiles</result>
</action>
<action name="searchEmployeesByName" class="my.package.EmployeeAction"
method="searchEmployeesByName">
<result name="success">/search_results.tiles</result>
</action>
</package>
<package name="department" namespace="/department" extends="tiles-default">
<action name="getDepartmentList" class="my.package.DepartmentAction"
method="getDepartmentList">
<result name="success">/department_list.tiles</result>
</action>
</package>
</struts>