What is MVC in struts 2 ?

 MVC in struts 2 :

In struts Model, View and Controller(MVC) is a design pattern, which is used to develop web application in java.
Model : It is responsible for retrieving data from the database and saving the data into the database. It also responsible to implements all business logic. When a data entered by the user through view are checked in the model before saving into the database. Data access, data validation and the data saving logic are part of model component.

View: It is represents the user view of the application which is responsible for taking the input from the user, dispatching the request to the controller and then receiving response from the controller and displaying the result back to the user. html, jsp, custom tag libraries, resources files are the part of view component.

Controller: It is intermediary between Model and View components. It is also responsible for receiving the request from client through view. Once request is received from client it executes the appropriate business logic from the Model and then produce the result to the user using the View component. ActionServlet, Action, ActionSupport and struts.xml are the part of Controller.

You can better understand through below diagram :

mvc diagram



What is interface in java

interface in java :


An interface is a contract, which define what a class can do. With interface if you will use public then you will have to write this interface in a separate file.
if you will not use public with interface then you can write interface in any class file. You can use abstract keyword with interface it’s depends on you. In interface you can also declare variable but it’s static and final type only.
When you will implements interface in a class then all method of interface should be override with public keyword within that class.

Note : An adjective should be always taken to write an interface.

Syntax :

interface <interface_name>{

final int VARIABLE1;
final int VARIABLEn;


Example :


interface MyInterface{
void display();

public class MyDemo implements MyInterface {
public void display(){
System.out.println("display method executing...");
public static void main(String[] args) {
MyInterface e=new MyDemo();