例程 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"输出到网页上。