title: Struts passing parameters from jsp to action
body: <p>I work with Struts 2.2.</p>
  
  <p>I have iterated over an <code>ArrayList</code> of users. I have an edit link for each user.</p>
  
  <p>When the edit link is clicked I want to find the user in a database and display its properties.</p>
  
  <p>Unfortunately the link does not take me to the desired page, instead it redirects me to the same page. Any ideas?</p>
  
  <p>display.jsp:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;logic:iterate id="customerElement" name="ACTIVE_PROFILES_LIST" property="list"&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;bean:write name="customerElement" property="lastName"/&gt;
      &lt;/td&gt;
  
      &lt;td&gt;
        &lt;bean:write name="customerElement" property="firstName"/&gt;
      &lt;/td&gt;
  
      &lt;td&gt;
        &lt;pdk-html:link action="/beforeEditProfile.do?toEdit=${customerElement.login}"&gt;Edit&lt;/pdk-html:link&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/logic:iterate&gt; 
  </code></pre>
  
  <p>Action class:</p>
  
  <pre><code>public class BeforeBeforeEditProfileAction(){
  
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws IOException,
                                                                      ServletException {
  
  
   // retrieve the parameter
  
  
      String toModify= request.getParameter("toEdit");  
      SearchBean search = new SearchBean();
      Cetatean cet = search.getSingleCitizen(toModify);
      LogManager.info("BeforeEditProfileAction: ENTER");
      if(cet!=null){
          request.setAttribute("cetatean", cet);
          LogManager.info("BeforeEditProfileAction: cetatean not null");
          return mapping.findForward("succes");
      }
      else {  
          LogManager.info("BeforeEditProfileAction: cetatean null");
          return  mapping.findForward("failure");
      }
  
    }
   }
  </code></pre>
  
  <p>struts-config.xml</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;action path="/beforeEditProfile" type="pm.action.BeforeEditProfileAction" name="user" validate="true" scope="request" input="/htdocs/pages/display.jsp"&gt;
    &lt;forward name="success" path="/htdocs/pages/editProfile.jsp"/&gt;
    &lt;forward name="failure" path="/htdocs/pages/profileEditedFailed.jsp"/&gt;
  </code></pre>