Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DynaActionForm, passing Collection to JSP

 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic