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 Using checkbox/multibox  to delete items from a list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Using checkbox/multibox  to delete items from a list" Watch "Using checkbox/multibox  to delete items from a list" New topic
Author

Using checkbox/multibox to delete items from a list

sonusgr sonusgr
Greenhorn

Joined: Apr 10, 2006
Posts: 4
Hi guys.
I ve got an action class that calls an EJB that returns a list. I am storing that list in the request scope and getting it back in the front end





As you can see I also want to use a check box for deleting the elements in my collection. I am retrieving the values normally so there is not problem here.
But the problem I am facing is that I need to have these values in a bean (Form) and call that form from another Action

something like





But of course I am getting an error message that "clients could not be found in any scope". So how am I gonna call the Form that I want my selected values stored in and at the same time extracting the collection that I have stored from the previus Action servlet??

Any reply is highly appreciated.

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
First of all, if you want to use attributes of the client bean in an <html:checkbox> tag, you need to add the collection of clients as an attribute to the ActionForm bean, rather than just storing it in the request.

Secondly, you need to code your JSP so that Struts will know you're using an indexed property. You can find the details on how to do this in this link. This includes adding an indexed getter (getClient(int index)) to your ActionForm.

Thirdly, you need to decide on how to deal with the ActionForm. If you change it's scope to session, the collection of clients will still be there when the form is submitted. If you want to keep it in the request, you are going to have to add code to your ActionForm to rebuild the collection of clients either in the indexed getter or in the reset() method. One option is to use the "LazyActionForm" as described in This link.


Merrill
Consultant, Sima Solutions
sonusgr sonusgr
Greenhorn

Joined: Apr 10, 2006
Posts: 4
thanks for the info
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using checkbox/multibox to delete items from a list