Jetty web server - 14.5.4 Using Definitions as Forwards in Struts Tiles

14.5.4 Using Definitions as Forwards in Struts Tiles definitions can also be used as Struts forwards, instead of actual URLs. To use definitions in this manner, you first create the definitions:

This fragment shows two definitions, the standard default definition and a second one that defines the layout for a “superuser.” A superuser might be someone that frequents the site and places many orders, and such a user might be given more options on the menu bar to facilitate faster ordering. In the Struts configuration file, we need to define the forwards that use these definitions: You can then use the Super_Success forward to send the user to the storefront.superuser.main definition just as you would for any other forward. 14.6 Internationalization Support with Tiles Although the Struts framework provides certain I18N capabilities that can be used with Tiles, Tiles also provides the ability to select a particular tile based on the user’s locale. To support this feature in your application, you need to create a different Tiles definition file for each locale that you need to support. For example, if you need to support a set of definitions for the U.S. locale and a separate set for the German locale, you must create two separate definition files: tiles-tutorial-defs_en.xml tiles-tutorial-defs_de.xml The suffix naming conventions follow the ones set by the java.util.ResourceBundle, which is also used by the resource bundles for Struts. When a request for a definition is made, the correct definition is determined by the included locale.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Leave a Reply