Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is ActionForm is mandatory in writing Action class

 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

Is ActionForm is mandatory in writing an Action class?
thanks in advance
saiprasanna
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are talking about execute methord , then its necessary to use ActionFor m there
 
Raghavendra nandavar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sai prasanna:
hi all,

Is ActionForm is mandatory in writing an Action class?
thanks in advance
saiprasanna


If you are talking about writing a seperate class for action form bean,
then there is another option where in, you need not write any action form
classes, you can use what is known as the DynaActionForms which are
present in the org.apache.struts.action package.

Instead of specifying your actionform in the struts-config.xml, you
can specify the type as org.apache.struts.action.DynaActionForm, and
declare the form properties.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is ActionForm is mandatory in writing an Action class?


Could you be more specific?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The short answer to this question is no, an ActionForm is not necessary for an action. If you specifiy

<action path="/myAction" type="com.mycompany.MyAction" />

in struts-config.xml, the ActionForm passed to the execute() method in MyAction will be null since you didn't specify the "name" attribute to identify a form bean attached to this action.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic