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 DynaActionForm, passing Collection to JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DynaActionForm, passing Collection to JSP" Watch "DynaActionForm, passing Collection to JSP" New topic
Author

DynaActionForm, passing Collection to JSP

Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
How can i pass Collection to JSP page via DynaActionForm?




it works when the method getAttribute() returns String, but when i want to pass Collection -exception is raised.


I need collection for filling a Combo Box in the JSP page.


If there is any simpler way for that -let me know PLEASE!


Best Regards
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Originally posted by Imre Tokai:
I need collection for filling a Combo Box in the JSP page.
HTML has no combo box. I assume you mean a <select>? Please read this for more information.

Also, as the DynaActionForm is a Struts class, I've moved this to the Struts forum.
[ June 04, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
Yes, i want to fill <select/>

But first i have to figure out how can i pass Collection to that page via DynaActionForm


Best Regards!

P.S.
Sorry for the misplaced topic, and thank you for putting it on the right track
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Just add a property of type java.util.List to the DynaActionForm. You can then call the set method to populate the property with a list of objects.


Merrill
Consultant, Sima Solutions
Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
I did that, but exception is raised: I'm able to pass only String.
If you have any code for that, let me see. Maybe i did sg on a wrong way...

Problem still not solved.


Regards
Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
Exception details:

javax.servlet.ServletException: Cannot assign value of type 'java.util.ArrayList' to property 'countries' of type 'java.lang.String'

in the *Form.java


Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DynaActionForm, passing Collection to JSP
 
Similar Threads
Show a progress page using Struts
html:optionsCollection from a DynaActionForm
populating forms in jsp
retriveing DynaActionForm property of type HashMap in JSP
Retrieve Form Values - null form values returned