Browse Today's favorites or All time favorites.
Please Sign In or Register to share and submit your questions.
Java Queries
Complete java interview questions library
Explain the Front Controller design pattern or explain J2EE design patterns?
A J2EE system requires a centralized access point for HTTP request handling to support the integration of system services like security, data validation etc, content retrieval, view management, and dispatching. When the user accesses the view directly without going through a centralized mechanism, two problems may occur:
- view is required to provide its own system services often resulting in duplicate code.
- View navigation is left to the views. This may result in shared code for view content and view navigation.
- Distributed control is more difficult to maintain, since changes will often need to be made in numerous places.
Generally you write specific servlets for specific request handling. These servlets are responsible for data validation, error handling, invoking business services and finally forwarding the request to a specific JSP view to display the results to the user.
The Front Controller suggests that we only have one Servlet (instead of having specific Servlet for each specific request) centralising the handling of all the requests and delegating the functions like validation, invoking business services etc to a command or a helper component. For example Struts framework uses the command design pattern to delegate the business services to an action class.
Write a comment