A welcome page refers to the page that appears when you specify a URL that is a directory. On UNIX systems, an example is /usr/local/ In web applications, this translates to http://localhost:8080/ , http://localhost:8080/restricted/ and on and on and on.The servlet specification states that the server should first locate the index.jsp page. If unavailable, then the index.html page. Now the servlet specification does not specify what the servlet/ web container should do if the index.jsp and/ or the index.html pages are unavailable. The next action of the server is therefore server specific. Some servlet containers simply throw an HTTP 404 error, others list the contents of that directory. Such divergent behaviour of servlet containers from the various vendors may make your application behave differently on different containers (much like the behaviour of programs running on different platforms such as UNIX and Windows without any code changes that were developed using other programming languages such as C). This definitely makes your web application much less portable.
In order to specify the resource that should be returned when a visitor of your site or user of your web app, you should consider the
The servlet container will be obliged to display firstPage.jsp first; if firstPage.jsp suddenly becomes unavailable for some sinister reason, then secondPage.html will be displayed instead. If secondPage conspires to go AWOL as well, the server loads up thirdPage.jsp. This helps in making issues explicit and not having to rely on server specific behaviour which in some cases may not be merciful. Consider the situation where the index.jsp and index.html files are unavailable and the server displays the contents of the directory as if it were on ftp. Also the server throwing a HTTP 404 Error. Such behaviour is definitely unacceptable. |
Wednesday, 17 March 2010
Explicitly Specifying Welcome Pages
Subscribe to:
Posts (Atom)