Questions tagged [front-controller]

The Front Controller Pattern provides a centralized entry point for handling requests in web applications.

Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.

144 questions
27
votes
1 answer

What is a Front Controller and how is it implemented?

First of all, I'm a beginner to PHP. And have posted a question here: Refactoring require_once file in a project . I've tried to read about Front controller as much as I can, but can't get how it works or even what's all about. Can somebody explain…
Rafael Adel
  • 7,673
  • 25
  • 77
  • 118
22
votes
3 answers

How to redirect all requests to a file, except images using Apache?

I have an .htaccess file with the following contents: Options +FollowSymLinks +ExecCGI RewriteEngine On RewriteRule ^(.*)$ entryPoint.php [QSA] With this, I want all requests to be redirected to the file…
user893856
  • 1,039
  • 3
  • 15
  • 21
13
votes
2 answers

Enable the request log, even when a router script is used for the PHP built-in web server

PHP's built in web server allows "router scripts" to be used, allowing for rewriting URLs internally. The problem with such a router script is the fact that whenever it actually handles a file instead of letting PHP handle it, this causes the…
user2064000
11
votes
4 answers

What are the advantages and disadvantages of using the Front Controller pattern?

I currently design all of my websites with a file for each page, then include common elements like the header, footer and so on. However, I've noticed that many frameworks and CMSs use the Front Controller pattern. What are the advantages and…
Philip Morton
  • 129,733
  • 38
  • 88
  • 97
10
votes
7 answers

Can a servlet determine if the posted data is multipart/form-data?

I have a servlet that is used for many different actions, used in the Front Controller pattern. Does anyone know if it is possible to tell if the data posted back to it is enctype="multipart/form-data"? I can't read the request parameters until I…
pkaeding
  • 36,513
  • 30
  • 103
  • 141
10
votes
1 answer

Front controller best way to link parameters to application logic?

I am building an app using Front Controller design pattern and there is just one page index.php through which all user requests pass as parameters (versus different pages/controllers in regular design). How can I connect these parameters to…
Roman Toasov
  • 747
  • 11
  • 36
9
votes
2 answers

How to create user-friendly and seo-friendly urls in jsf?

For example, I have class Article with methods getTitle () and getContent (). I also have ArticlesService with method getAllArticles (). How to create a list of links with meaningful names (formed with #{article.title})?…
Roman
  • 64,384
  • 92
  • 238
  • 332
6
votes
2 answers

PHP Front Controller implementation without singleton : conceptual question

i have a "conceptual" question about Front controller implementation in php. Most of the Front Controllers i have seen around are implemented with Singleton, i am not a big fan of singleton pattern and i created a Container which has a static…
fat
  • 5,098
  • 4
  • 28
  • 31
6
votes
2 answers

Java Front Controller

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
user237865
  • 1,250
  • 4
  • 19
  • 41
6
votes
3 answers

"Proper" separation/difference between index.php and front controller

For a PHP MVC application, what is the difference of the job of the index.php file and front-controller? Is the front-controller in the index.php, or is it in a separate file? How do I separate the two and let them work together? Is the…
user2486953
6
votes
2 answers

Zend Framework: How to disable default routing?

I've spent many hours trying to get this to work. And I'm getting quite desperate. Would be great if someone out there could help me out :) Currently using Zend Framework 1.9.5, though I have been struggling to get this to work for many versions…
Maurice
  • 4,829
  • 7
  • 41
  • 50
6
votes
2 answers

Routing requests through index.php with nginx

I'm migrating my server from Apache to Nginx and have this very simple .htaccess rule: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] The idea behind it is to direct every request to a front controller…
James Dawson
  • 5,309
  • 20
  • 72
  • 126
5
votes
2 answers

front controller , Page controller?

what is the difference between front controller and page controller? which is the best?
software
  • 728
  • 6
  • 18
  • 39
4
votes
2 answers

get current controller

in a function I want to reach current controller: $front = Zend_Controller_Front::getInstance(); this only gives a handler but not current controller. I changed the code from function to inside of controller. and asked their origins both the…
nerkn
  • 1,867
  • 1
  • 20
  • 36
4
votes
1 answer

Front controller pattern - is router a front controller?

I'm trying to understand how a Front Controller should look like. From Wikipedia, The Front Controller pattern is a software design pattern listed in several pattern catalogs. The pattern relates to the design of web applications. It "provides…
Run
  • 54,938
  • 169
  • 450
  • 748
1
2 3
9 10