• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create a DynaValidatorForm

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

could you help me with that?

how to create a DynaValidatorForm inside my Action!??!

Thnx
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a link to some valuable information about DynaActionForm and DynaValidatorForm.

http://struts.apache.org/struts-doc-1.2.x/userGuide/building_controller.html#dyna_action_form_classes

Your answer is in the following quote from that document:


DynaActionForms cannot be instantiated using a no-argument constructor. In order to simulate the extra properties, there is a lot of machinery involved in their construction. You must rely on Struts to instantiate a DynaActionForm for you, via the ActionMapping.



What this means is that if you have an action such as initializeLoginPage, and you have defined a DynaValidatorForm as loginForm, you must assign loginForm to the initializeLoginPage action. Struts will then instantiate loginForm for you and pass it as a parameter to the execute() method of the Action class defined in the initializeLoginPage mapping.

The parameter comes in as type ActionForm, but you must cast it as type DynaVaidatorForm in order to use it.
[ January 13, 2006: Message edited by: Merrill Higginson ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic