• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using checkbox/multibox to delete items from a list

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
sonusgr sonusgr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the info
 
reply
    Bookmark Topic Watch Topic
  • New Topic