Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Raaghu Kannan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please confirm whether corresponding action gets executed on the event of 'Change'? Moreover, show that action class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic