wood burning stoves 2.0*
The moose likes Struts and the fly likes Populating List thru logic:iterate , The modified List is not reaching action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Populating List thru logic:iterate , The modified List is not reaching action" Watch "Populating List thru logic:iterate , The modified List is not reaching action" New topic
Author

Populating List thru logic:iterate , The modified List is not reaching action

Raaghu Kannan
Greenhorn

Joined: Aug 19, 2011
Posts: 8
Hi

I am developing a application which reads a XML , The values of these XML are set in a "Object" (consumerXML) and that object is set in a list and list will be set in session , Key being "results"



The Flow is like this

1. Welcome JSP whose actionform is consumerxmlActionForm --> No Issues here
2. editxml.jsp Even here the actionform is consumerxmlActionForm --> here list gets populated but doesnt pass the same, back.

*********************************************************************************************************
editxml.jsp

<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>


<html:html locale="true">

<head>

<title>Middleware UI</title>
<script language="JavaScript">
function submitFormEdit(frm,cmd) {
frm.operation.value = cmd;
frm.submit();
}
</script>
<html:base />

</head>

<body bgcolor="white">

<html:form action="/consumerxmlActionForm">
<html:hidden property="operation" />

<html:errors />

<table>

<tr>
<td align="center">beanID</td>
<td align="center">dayStartTime</td>
<td align="center">dayEndTime</td>
<td align="center">dayThreshold</td>
<td align="center">nightThreshold</td>

</tr>
<logic:iterate id="consumerXML" name="results" >
<tr>
<td align="center"><html:text name="consumerXML"
property="beanID" /></td>
<td align="center"><html:text name="consumerXML"
property="dayTime" /></td>
<td align="center"><html:text name="consumerXML"
property="nightTime" /></td>
<td align="center"><html:text name="consumerXML"
property="dayThreshold" /></td>
<td align="center"><html:text name="consumerXML"
property="nightThreshold" /></td>
</tr>
</logic:iterate>

<tr>
<td align="right"><html:submit onclick="submitFormEdit(consumerxmlActionForm, 'edit')">Change</html:submit></td>
</tr>
</table>
</html:form>
</body>
</html:html>


**********************************************************************************************************







editxml.jsp displays the list properly, when I click on the "change" button I dont get the "results" in session. Is there any other way to fetch that list??

Thanks and Regards
Raaghu.K
Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

The scope of request attribute value is a limited one. The result list set in request scope on ConsumerXMLAction.java and mapping editxml.jsp can obtain the same. Again you are making another request to server by clicking change button. But here you would not get result list in the corresponding action which set in ConsumerXMLAction.java. That needs to be passed thru form. Otherwise change scope as session instead of request.
Raaghu Kannan
Greenhorn

Joined: Aug 19, 2011
Posts: 8
Thanks For your reply

I have changed the scope to session still it is not the list is null... Following is struts-config



Thanks and Regards
Raaghu.K
Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

Please confirm whether corresponding action gets executed on the event of 'Change'? Moreover, show that action class.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Populating List thru logic:iterate , The modified List is not reaching action