Fish & Chips Club
Class CustomController

  extended by GenericServlet
      extended by HttpServlet
          extended by Controller
              extended by
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public final class CustomController
extends Controller

Example implementation of translation by using multiple JSPs.

The one-JSP-per-language style is implemented by providing an override for Controller.swapResponsePage(ResponsePage , Locale), as done here.

This style of implementing translation is not recommended, since it causes so much repetition of identical markup across many JSPs. The services of the hirondelle.web4j.ui.translate package should be used instead.

Here, only one particular feature is affected - the Visits page, which is split into Visit_en.jsp and Visit_fr.jsp, when this custom Controller is used.

(The Visit.jsp page uses the recommended style of translation, where markup is not repeated across multiple pages.)

This example is not complete - it merely exercises the general mechanism. To run it, edit the servlet-class setting in web.xml to refer to this custom Controller class. After starting the app, then navigate to the Visits page, and flip the Locale using the Preferences page. This will exercise the mechanism.

See Also:
Serialized Form

Field Summary
Fields inherited from class Controller
Constructor Summary
Method Summary
protected  ResponsePage swapResponsePage(ResponsePage aResponsePage, Locale aLocale)
          Returns a non-null value only if aResponsePage ends with 'Visit.jsp'.
Methods inherited from class Controller
destroy, doDelete, doGet, doPost, doPut, init, logAndEmailPerformanceProblem, logAndEmailSeriousProblem, processRequest
Methods inherited from class HttpServlet
doHead, doOptions, doTrace, getLastModified, service, service
Methods inherited from class GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public CustomController()
Method Detail


protected ResponsePage swapResponsePage(ResponsePage aResponsePage,
                                        Locale aLocale)
Returns a non-null value only if aResponsePage ends with 'Visit.jsp'.

swapResponsePage in class Controller

Fish & Chips Club

Copyright Hirondelle Systems - Generated 2013Oct19.12.26