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 Struts2 polymorphic list in select tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 polymorphic list in select tag" Watch "Struts2 polymorphic list in select tag" New topic
Author

Struts2 polymorphic list in select tag

Tony Manello
Greenhorn

Joined: Aug 11, 2010
Posts: 13
Hi All, I have a list with several inherited objects so the List is defined with the parent object (it's defined as abstract) as parameter. In the prepare() method of the action I retrieve from DB all the child objects and I add them to the List<Parent> list. It works ok until I use that list in a select tag. Then it throws a npe exception. What am I doing wrong?

Thanks in advance!
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

how are you using the list in the jsp? Some code might help
Tony Manello
Greenhorn

Joined: Aug 11, 2010
Posts: 13
Hi I think I use the list as usual:

Snippets:

Action:

Ejercicio is the parent class (abstract) and child classes are Estiramientos, Pesas, Progresivos, Serie, CarreraContinua, CambiosRitmo.

List<Ejercicio> listaEjercicios is the parent's objects list containing all child objects. I have split in several child's lists just as a matter of retrieving listaEjercicios sorted by the child's type.



JSP:



Any advice?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 polymorphic list in select tag