Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
    Bookmark Topic Watch Topic
  • New Topic

problem in converting from session scope to request scope in struts  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
Currently our application works fine on Scope Session, now due to client requirement we need to change the scope from session to request. When changing the scope of the application as request(in struts-config.xml), the value of an array of checkboxes(used to display checkboxes depending on no. of policies) is not passed from one action to the other.

The code that I have written:

Action Form:

public String getPolicyHolderChecked(final int index) {
int numberOfPolicyHolders = selectPolicyHolders.size();

if (!selectPolicyHolders.isEmpty()) {
if (policyHolderChecked == null || numberOfPolicyHolders != policyHolderChecked.length) {
this.policyHolderChecked = new String[numberOfPolicyHolders];

for (int i = 0; i < numberOfPolicyHolders; i++) {
this.policyHolderChecked[i] = String.valueOf(false);

return policyHolderChecked[index];

public void setPolicyHolderChecked(final int index, final String policyHolderChecked) {
this.policyHolderChecked[index] = policyHolderChecked;


In our JSP the array of checkboxes are created using < logic:iterate >
They are iterated using the Indexid and its value is initially set to 0.
The property for that checkbox array is <% = "policyHolderChecked[" + index + "]" %>


<action path="/searchPoliciesAdvanced" type="" name="searchFormBean" scope="request" input="" parameter="dispatch" validate="true">
<forward name="back" path="">
<forward name="display" path="">

Action class:

public class SearchPolicyOptionsAction extends SearchCoreAction {
private GCDDelegate gcdDelegate;

public ActionForward execute(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
ActionMessages actionMessages;
ActionForward forward = super.execute(mapping, form, request, response);
SearchForm searchForm = (SearchForm) form;

return forward;
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

Author and ninkuma
Posts: 66424
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is also the 3rd time you have posted this same question despite being asked to not post the same question more than once.

This topic is closed.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!