• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

ActionForm

 
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class RegisterForm extends ActionForm

{

}

I have this in my execute method of the Action class :

Registerform rf = (RegisterForm) form; // what exactly is happening here ?

RegisterForm is not an abstract class then , why can we not create an instance of Registerform ? Also I read "The base ActionForm class cannot be instantiated". Is it because the ActionForm class is mentioned as abstract in the api docs :
public abstract class ActionForm extends Object implements Serializable

Is the ActionForm a javabean ?? If yes what are the rules/specifcation for a javabean ? Are there any datatype an ActionForm can/cannot take. Few rules for a class to be a java bean are :

1. must have getters and setters
2. must implement Serializable.
3.... ?
4.... ?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Registerform rf = (RegisterForm) form; // what exactly is happening here ?

What do you mean? The form is being cast to an instance of RegisterForm.

> why can we not create an instance of Registerform

What makes you think you can't?

> Is the ActionForm a javabean

It *could* be, but doesn't have to be:

http://en.wikipedia.org/wiki/JavaBean
http://struts.apache.org/1.2.7/api/org/apache/struts/action/ActionForm.html

I don't understand the rest of your JavaBean questions.
 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to know why is the ActionForm(org.apache.struts.action.ActionForm) class created as an abstract class , whereas the action(org.apache.struts.action) is not abstract ?

 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
H David Newton,

public class RegisterForm extends ActionForm

{

}

Registerform rf = (RegisterForm) form;

I read this in "Struts in Action", so not sure why we are not creating an instance of the Registerform like :
Registerform rf = new Registerform();

Thanks for the two links that you provided.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because the form already exists and is populated with form data. If you created a new one you'd have an empty form.
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic