Introduction:
If you are
building a news website or blogging website where you have 1000 of pages to
serve, it’s impossible to write 1000 html pages. In that case, you write just
one html page and you can write some logic where every page URL will go to same
html page and dynamically you can load content of that specific page via Ajax
and JavaScript.
We can develop
this by using one single html page which is called Single Page Application (SPA).
Example:
If you have
a blogging website where you have pages like this:
https://www.xeloxo.com/technology/q448/What-is-TOR-Web-Browser
https://www.xeloxo.com/technology/b1000576/-interview-questions
https://www.xeloxo.com/technology/b1000873/Google-Pay-users
Step 1:
First create
one Filter in Java class which can be used to filter and handle all your
request and forward them to home page html.
Step 2:
We will
define our web.xml so that our filter can be handled.