This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Map based Action Form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Map based Action Form" Watch "Map based Action Form" New topic
Author

Map based Action Form

Brian Quinn
Ranch Hand

Joined: Dec 23, 2003
Posts: 32
I am trying to create a dynamic form on my web app, and thought the map based action form would be my best choice (I am wedded to struts). I will be putting up x amount of properties, some single select, some multiple select. However, when I write my unit tests , I am seeing that struts will not put a String[] into a mapped property - it will only take the first value - here's my test code:



I get a ClassCast Exception on this line:
String[] results = (String[]) resultMap.get("by Service Code");

Any ideas what causes this or how I can build a form that I won't know the properties til runtime ?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Map based Action Form
 
Similar Threads
Newbie having problems with StrutsMocktestCase
How do I set value in my test case method for testing Action Class?
StrutsTestCase-Problem with MockStrutsTestCase
JSTL sql taglib and html drop down box
testing Action class through StrutsTestCase