Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
wierd problem

wierd problem

2007-10-01       - By Henry Park

 Back

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

©2008 junlu.com - Jax Systems, LLC, U.S.A.