例程 2-2 application.properties文件#application resources for the "hello" sample applicationhello.jsp.title=hello - a first struts programhello.jsp.page.heading=hello world! a first struts applicationhello.jsp.prompt.person=please enter a username to say hello to :hello.jsp.page.hello=hello#validation and error messages for helloform.java and helloaction.javahello.dont.talk.to.monster=we don't want to say hello to monster!!!hello.no.username.error=please enter a <i>username</i> to say hello to!
以上文件以"消息key/消息文本"的格式存放數據,文件中"#"后面為注釋行。對于以下jsp代碼:
<bean:message key="hello.jsp.title"/>
<bean:message>標簽的key屬性為"hello.jsp.tilte",在resource bundle中與之匹配的內容為:hello.jsp.title=hello - a first struts program
因此,以上<bean:message>標簽將把"hello - a first struts program"輸出到網頁上。