struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henry Park <hspark...@hotmail.com>
Subject wierd problem
Date Mon, 01 Oct 2007 23:28:15 GMT

I am having a wierd problem where my action calls are not forwarding to the correct page.
 Actually it works one time, but when I try to run the same action again (this time on the
same page) it attempts to go to a different action (i.e. INPUT). Here is how I have it set
up:
 
struts.xml:
<action name="ItemList" class="action.ItemAction" method="list">
<result name="success">/jsp/items.jsp</result>
</action>
<action name="Item" class="action.ItemAction" method="view">
<result name="input">/jsp/itemEdit.jsp</result>
<result name="success">/jsp/itemView.jsp</result> 
</action>
 
items.jsp:
 
<s:form method="post" theme="simple" name="theForm">
<s:iterator value="resultList" status="status">
 
<a onClick=retrieveURL('<%= request.getContextPath() %>/Item!view.action?someBean.itemId=<s:property
value="item_id"/>', main_span, null, "POST");>
<s:property value="item_details"/><br>
</a>
</s:iterator>
</s:form>
 
 
itemView.jsp:
<script language='javascript'>
function sort() {
  ... sorting code ...
  retrieveURL("<%= request.getContextPath() %>/Item!view.action", main_target, "POST");
}
function retrieveURL(url, target, postMethod) {
  try {
    var params = Form.serialize($('theForm'));
  } catch (e) {
    var params = "";
  }
  new Ajax.Request(url, 
  { 
    method:postMethod,
    parameters:params,
    postBody:params,
    onSuccess: function(transport) { 
      var response = transport.responseText;
      target.innerHTML = response; 
    },
    onLoading: function() {
      showLoader(true);
    },

  });
}
</script>
<s:form method="post" theme="simple" name="theForm">
<s:hidden name="someBean.itemId" value="%{someBean.itemId}" />
<s:hidden name="someBean.sortColumn" value="%{someBean.sortColumn}" />
<s:hidden name="someBean.sortDirection" value="%{someBean.sortDirection}" />
<s:property value="%{someBean.itemId}"/><br>
<s:property value="%{someBean.itemName}"/><br>
<s:property value="%{someBean.itemDescription}"/><br>
<hr>
<input type='button' onClick='sort("actual");' value='Sort'/>
<s:iterator value="AssociatedItemList" status="status">
<s:property value="dateRange"/> - <s:property value="actual"/> - <s:property
value="target"/><br>
</s:iterator>
 
So on 'items.jsp' I click on a line item and it successfully forwards to the 'success' page.
However, on the details screen when click on 'sort', it calls the same action but does not
return to the same page.
 
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message