While migrating from Struts1 to Struts2, I have encountered DynaActionForm
. Please provide code snippet as example which will help convert to Struts2.
Tried lot of google search but no luck!
Asked
Active
Viewed 1,411 times
-1
-
https://struts.apache.org/docs/migration-strategies.html – Alireza Fattahi Aug 31 '15 at 08:39
-
http://www.infoq.com/news/migrating-struts2 – Alireza Fattahi Aug 31 '15 at 08:39
1 Answers
0
There's no such DynaActionForm
in Struts2. If you want to set properties dynamically then use a Map
.
Map<String, Object> dynaActionForm;
//getter and setter here
...
dynaActionForm.put("property1", object1.getProperty1());
dynaActionForm.put("property2", object2.getProperty1());
In the JSP you can access this properies
<s:property value="dynaActionForm.property1"/>
<s:property value="dynaActionForm.property2"/>

Roman C
- 49,761
- 33
- 66
- 176
-
Appreciate your prompt reply. I am new to struts. In my case, DynaAction form is in Filter. Then, Please let me know 1> If the entries in the struts_config.xml needs to be removed. 2> how to replace the code String password = (String)form.get("password"); in the filter. – Test Sep 01 '15 at 15:20
-
-
Before you `get` you should `put` properties to the form, whatever form definition you use you can always have variable number of properties. Make sure you bind them on the page. – Roman C Sep 09 '15 at 13:54