What is DynaActionForm?

The Struts DynaActionForm class enables you to create a "virtual" form bean in Struts configuration file instead of create a real Java form bean class. It can avoid you to create many simple but tedious form bean classes.
 DynaActionForm do not  have to write setters and getters. No bean class is required for the DynaActionForm.  
With DynaActionForm, the property access is no different than using request.get Parameter( .. ).
DynaActionForm construction at runtime requires a lot of Java Reflection (Introspection) machinery that can be avoided.

struts-config.xml :-

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd"> 
<struts-config>
<form-beans>
<form-bean name="dynaUserForm" type="org.apache.struts.action.DynaActionForm">
   <form-property name="username" type="java.lang.String"/>
</form-bean>
</form-beans>
<action-mappings>
<action path="/Login" type="WiseDeveloper.co.in.UserAction" name="dynaUserForm">
<forward name="success" path="success.jsp"/>
<forward name="failed" path="login.jsp"/>
</action>
</action-mappings>
<message-resources parameter="WiseDeveloper.co.in.ApplicationResource" />
</struts-config>

 

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More