Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 570917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:27:08+00:00 2026-05-13T13:27:08+00:00

I’m thinking of implementing Front Controller in my J2EE application. Could you please suggest

  • 0

I’m thinking of implementing Front Controller in my J2EE application. Could you please suggest the same with few links (with source code examples) & any standards to follow?

Best regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:27:09+00:00Added an answer on May 13, 2026 at 1:27 pm

    To start, create a Servlet which listens on a certain url-pattern, e.g. /pages/*. Implement the service() method to lookup the action associated with the request method (GET, POST, etc) and pathinfo (the URL part after the servlet’s url-pattern).

    Basic example:

    protected void service(HttpServletRequest request, HttpServletResponse response) 
      throws ServletException, IOException {
      View view = new View(request, response);
      Action action = ActionFactory.getAction(request);
      action.execute(view);
      view.navigate();
    }
    

    The Action interface should represent an unit of work. You can implement it to do the necessary business logic:

    public interface Action {
      void execute(View view);
    }
    

    The ActionFactory should maintain the classes implementing Action in sort of Map<String, Action> where the String key represents less or more a combination of the request method and pathinfo. You could then get an Action as follows:

    public static Action getAction(HttpServletRequest request) {
      return actions.get(request.getMethod() + request.getPathInfo());
    }
    

    The View should represent the request scoped context which the Action can work with. In the navigate() you could forward the request to a JSP for display:

    public void navigate() {
      String path = "/WEB-INF" + request.getPathInfo() + ".jsp";
      request.getRequestDispatcher(path).forward(request, response);
    }
    

    That should get you started (note that I left all obvious checks such as null pointers away to make the examples less cluttered, that’s up to you now).

    There is however more to take account with in the whole story, such as validation, conversion, event handling, input value mappings, localization, dependency injection, etcetera. That’s all with all quite a work. The more decent MVC frameworks takes most of this all into account, such as Sun JSF, Apache Struts, Spring MVC, Stripes, etcetera. If you have never done any of them, then I strongly recommend to do so before homegrowing one, otherwise you would end up with a waste of time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 297k
  • Answers 297k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There are no shortcuts.The mouse had to be interfaced with… May 13, 2026 at 7:22 pm
  • Editorial Team
    Editorial Team added an answer Are you happy to fetch all the "earlier" results? If… May 13, 2026 at 7:22 pm
  • Editorial Team
    Editorial Team added an answer In C99, you can declare your variables where you need… May 13, 2026 at 7:22 pm

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.