title: Saving page field values with Struts2 using javascript with a link
body: <p>I know from a previous question <a href="https://stackoverflow.com/questions/33556431/why-my-jsp-page-values-are-not-loaded-into-my-action-with-a-link-method">(page values are not loaded)</a> I can't use a link to submit a form.  I either need to make a button look like a link or use JavaScript.  I have the following link inside of an iterator.</p>
  
  <pre><code>    &lt;s:iterator value="chosenShipperViewList"&gt;
          &lt;div class="col-sm-3 col-xs-12 text-left"&gt;
              &lt;s:url var="deleteLink"&gt;&lt;s:param name="shipperName" value="%{organizationInfo.orgName}"&gt;&lt;/s:param&gt;&lt;/s:url&gt;
              &lt;s:a id="deleteShipper" onclick="deleteShipperFromChosenShipperViewList();" href="%{deleteLink}" &gt; 
                  &lt;img    src="/llr/theme/delete.gif" width="16" height="16" alt="Map Red X" &gt;
              &lt;/s:a&gt;
          &lt;/div&gt;
          &lt;hr&gt;
  &lt;/s:iterator&gt;
  </code></pre>
  
  <p>The JavaScript function is</p>
  
  <pre><code>function deleteShipperFromChosenShipperViewList(){
  if(confirmDelete()){
          var oldAction = document.getElementById("shipment").action;
          var url = oldAction.replace("shipment","shipment"+"_deleteShipperFromChosenShipperViewList");
          document.forms[0].action = url;
          document.forms[0].submit();
  }
  </code></pre>
  
  <p>};</p>
  
  <p>The only field value which makes it to the java action page is the <code>shipperName</code> which is passed as a parameter so I obviously am not using the JavaScript function correctly with the link.  Any help would be appreciated.</p>