JSP Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 411 Page Views: 

Why is ActionForm a base class rather than an interface?



Posted By: Avi Date: 9 November 2010 08:32:59 AM
 Answer:

The MVC design pattern is very simple to understand but much more difficult to live with. You just need this little bit of Business Logic in the View logic or you need just that little bit of View logic in the Business tier and pretty soon you have a real mess. Making ActionForm a class takes advantage of the single inheritance restriction of Java to it makes it more difficult for people to do things that they should not do. ActionForms implemented as interfaces encourage making the property types match the underlying business tier instead of Strings, which violates one of the primary purposes for ActionForms in the first place (the ability to reproduce invalid input, which is a fundamental user expectation). ActionForms as an interface would also encourage using existing DAO objects as ActionForms by adding ‘implements ActionForm’ to the class. This violates the MVC design pattern goal of separation of the view and business logic. Since the goal of struts is to enforce this separation, it just makes more sense for Struts to own the ActionForm. DynaActionForms relieve developers of maintaining simple ActionForms. For near zero maintenance, try Niall Pemberton's LazyActionForm


Posted By: avibtech


Date: 9 November 2010 08:32:59 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image LxyoXH
Related Questions
JSP : How HTTP Servlet handles client requests?  

How HTTP Servlet handles client requests?  

By using its service method that supports standard HTTP client requests by dispatching each request ....
Category: JSP Date: 11/5/2010 8:46:58 AM
JSP : What is the Max size of a Session Object?

What is the Max size of a Session Object?

There is no such limit on the amount of information that can be saved in a Session Object.  The....
Category: JSP Date: 11/5/2010 8:14:57 AM
JSP : What is session?

What is session?

The session is an object stored on the server used by a servlet to track a user's interaction with a....
Category: JSP Date: 11/5/2010 4:14:56 AM
JSP : How do servlets handle multiple simultaneous requests?

How do servlets handle multiple simultaneous requests?

When a request comes in, the web server will start a new thread and the request is assigned to a thr....
Category: JSP Date: 11/5/2010 2:58:58 AM
JSP : When init() and Distroy() will be called?

When init() and Distroy() will be called?

A init() is called whenever the servlet is loaded for the first time into the web server. Destroy wi....
Category: JSP Date: 11/5/2010 2:25:58 AM