Logo F2FInterview

Struts Interview Questions

Q   |   QA

Pull-MVC and Push-MVC are better understood with how the view layer is getting data i.e. Model to render. In case of Push-MVC the data( Model) is constructed and given to the view layer by the Controllers by putting it in the scoped variables like request or session. Typical example is Spring MVC and Struts1. Pull-MVC on the other hand puts the model data typically constructed in Controllers are kept in a common place i.e. in actions, which then gets rendered by view layer. Struts2 is a Pull-MVC based architecture, in which all data is stored in Value Stack and retrieved by view layer for rendering.

No,Unlike Struts2 action, Interceptors are shared between requests, so thread issues will come if not taken care of.

Apart from the fact that both Interceptors and filters are based on intercepting filter,there are few differences when it comes to Struts2.


  1. Based on Servlet Specification
  2. Executes on the pattern matches on the request.
  3. Not configurable method calls


  1. Based on Struts2.
  2. Executes for all the request qualifies for a front controller( A Servlet filter ).And can be configured to execute additional interceptor for a particular action execution.
  3. Methods in the Interceptors can be configured whether to execute or not by means of excludemethods or includeMethods. ( see tutorial on this Controlling Interceptor Behavior)

There are two possibilities why filter is designated as front controller in Strtus2

  1. Servlet made as front controller needs developer to provide a right value in which lets the framework to initialize many important aspects( viz. struts configuration file)as the container starts.Inabsense of which the framework gets initialized only as the first request hits.Struts2 makes our life easy by providing front-controller as a filter,and by nature the filters in web.xml gets initialized automatically as the container starts.There is no need of such load-on-startup tag.
  2. The second but important one is , the introduction of Interceptors in Struts2 framework.It not just reduce our coding effort,but helps us write any code which we would have used filters for coding and necessary change in the web.xml as opposed to Struts1.So now any code that fits better in Filter can now moved to interceptors( which is more controllable than filters), all configuration can be controlled in struts.xml file, no need to touch the web.xml file.
  3. The front controller being a filter also helps towards the new feature of Struts ie UI Themes. All the static resources in the Themes now served through the filter

The class “org.apache.struts2.dispatcher.FilterDispatcher ” is the front controller in Struts2. In recent time Struts 2.1.3 this class is deprecated and new classes are introduced to do the job.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: