Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

MessageResources and Application.properties Files

The hello.jsp file uses the <bean:messages> tag to display a banner title and data entry prompt. Listing 3.2 presents the file where the actual text is stored.

Listing 3.2 The Application.properties File for Hello World!

; Application Resources for the "Hello" sample application
; Update History:
; Date   Whom  Action
; ======== ====  ======
; 06/01/02 kmb  Creation

; Application Resources that are specific to the hello.jsp file

hello.jsp.title=Hello - A first Struts program
hello.jsp.page.heading=Hello World! A first Struts application
hello.jsp.prompt.person=Please enter a name to say hello to :

; Validation and error messages for HelloForm.java and HelloAction.java

ch03.hello.dont.talk.to.atilla=I told you not to talk to Atilla!!!
ch03.hello.no.person.error=Please enter a <i>PERSON</i> to say hello to!

You can see that some of the properties are used in the hello.jsp file, but others are accessed from Java classes as well. Comments have been added for organization.

Also, the properties themselves have been named in a way that makes them easier to manage. For example, all properties accessed from the hello.jsp file follow the naming pattern hello.jsp.foo.bar. When you have a large application with numerous tags, this makes understanding the file much easier.

  • + Share This
  • 🔖 Save To Your Account