RHS -> Allan-> WSPJ ->Exercises ->LoginLanguage

Language dependent pages

Using HTTP request headers

I assume that you have completed the exercise Login check

The HTTP protocol specifies a request header Accept-Language. This header specifies the client's preferred languages [Hall, page 64].

You job is to use this header to make a language dependent login form, i.e. if the Accept-Language indicates that the user wants Danish you should write brugernavn and kodeord, not username and password. Feel free to use any language you find interesting.

Google has a similar feature.

Getting started

  1. Open NetBeans.
  2. Create a new project. Type: web application.

Login form

The login form must now be dynamic - adapting to the preferences of the user.

The login form must now be programmed as a Servlet, not as static HTML. That requires quite a lot of out.println(...) lines!

The Servlet must include if statements to distinguish between different languages.

Special situations:


Maintained by: Allan Helboe
Updated: 28 November, 2007 15:57