The DynaActionForm differs from the ActionForm in one critical way: the
ActionForm class is a real Javabean with getter/setters for your properties.
Hence it can be used with other third party taglibs such as JSTL etc. The
DynaActionForm does not have getters/setters for your properties. The only
reason it works with Struts taglibs is because Struts taglibs recognize the
DynaActionForm as something unique and process it differently.

I have a question for the folks in general. What is the main reason for
using the DynaActionForm class (as opposed to writing your own ActionForm)?
While you don't have to write your own class with DynaActionForm, aren't you
restricting yourself to using Struts taglibs (especially the bean taglibs?).
What if you want to use JSTL now or sometime in the future? With the IDE's
that we all use today, creating an ActionForm class with getter/setter
methods is a breeze. Hence, what do you truly gain by using DynaActionForm?
Giri

----- Original Message -----
From: "Mark Minnie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 19, 2003 11:04 PM
Subject: DynaActionForm question


"Struts in Action" on page 162 reads:

"You can use a DynaActionForm anywhere an ActionForm can be used.  You can
also substitute a DynaActionForm for a conventional ActionForm without
changing any of the existing Java or JSP code."

I changed a ActionForm to a DynaActionForm by using the struts-config.xml:

    <form-bean name="loginForm"
type="org.apache.struts.action.DynaActionForm" dynamic="true">
       <form-property name="username" type="java.lang.String"/>
       <form-property name="password" type="java.lang.String"/>
    </form-bean>

I thought I would not have to change my existing code in the Action java
code, but my existing code did not work.  I originally had:

        String username = ((LoginForm)form).getUsername();
        String password = ((LoginForm)form).getPassword();

The LoginForm was the form bean that I had created manually in java.  I
deleted the LoginForm and replaced the form bean with a DynaActionForm as
listed above.  Of course, once I no longer have a LoginForm.java file
because it is a DynaActionForm, this Action java code does not compile.

Therefore I see that I have to change my code in going from a manually coded
form bean to a DynaActionForm.

Am I missing something?

TIA

Mark


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 12/30/2002

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to