File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Can't see the data of the vector in the Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Can Watch "Can New topic
Author

Can't see the data of the vector in the Action

AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Hi,

I got a couple of entities in a entity that is added to a vector. I can display th data on the jsp but when i press submit and check for the values in the action, it shows the entities are null

eg.
<nested:iterate id="shiftAllocation" type="vo.ShiftAllocation" property="shiftAllocationVec" name="shiftAllocationSearchForm">
<tr class="trClass">
<td class="tdClass"><nested:write name="shiftAllocation" property="vrDuty.dutyName"/> </td>
<td class="tdClass"><nested:text name="shiftAllocation" property="misShiftAlloc.shiftAllocation" styleClass="textLargeClass" /> </td>
</tr>
</nested:iterate>

in my ActionFrom i got a get() and set() for shiftAllocationVec.

When i look at the data for shiftAllocationVec, it shows that it has 6 shiftAllocation Entities( which is the no. of rows i am displaying).
But when i look inside this entity, the values are null.

A shiftAllocation Entity consists of a vrDuty entity and a misShiftAlloc entity.


What am doing wrong?

Thanks

Anil
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi

Actually u might have set the from bean before coming to jsp in some action .As soon as u come to that jsp u r displaying that ..........but after submitting this page if the scope of the form bean is request then that vector wont be avialble for u .

so u need to set the scope if u want it to be avialable across different requests.

i hope this is what u r trying for sreenathn@huawei.com
AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Thanks Sreenath,

But making the scope "session" based does not help. I can see the vector and it contains the no. of rows that was displayed. But it does not contain the values of the entities that was displayed. For example misShiftAlloc = null in this case

Thanks

Anil
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi

There is no way that this can happen and i feel u r having a vector of objects ....and that each object having set and get methods . As long as the scope of the form bean is not lost there is no way that objects canm be lost untill unless u r explicitly setting them to null by any chance check it out ........
AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137
Hi Sreenath,

Actually in that object - it consists of two other objects. So when the submit is hit, it seems it cannot determine where to put the values.

Thanks

Anil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't see the data of the vector in the Action