Home
Modifying application resources
The wizard created an empty ApplicationResources.properties file in the rad75strutsweb.resources package, and we have to update it with the texts and messages for our application.
While developing Struts applications, you usually find it helpful to have this file open, because you typically add messages to it as you go along writing your code. Again, this properties file is meant to externalize messages and, more importantly, support i18n (internationalization) for Web site language support. Example | 5-1 shows a completed ApplicationResources.properties file.
Example 15-1 ApplicationResources.properties
# Optional header and footer for <errors/> tag.#errors.header=<ul>#errors.footer=</ul>errors.prefix=<li>errors.suffix=</li>
form.ssn=SSNform.accountId=Account Idform.balance=Balanceform.amount=Amount
form.accountDetails.transactionId=Transaction IDform.accountDetails.transactionType=Transaction Typeform.accountDetails.transactionTime=Transaction Date-Timeform.accountDetails.transactionAmount=Transaction Amount
form.transaction.amount=Amount
errors.required={0} is a required Fielderror.ssn=Verify that the customer ssn entered is correct.error.amount=Verify that the amount entered is valid.error.timeout=Your session has timed out. Please login again.errors.systemError=The system is currently unavailable. Please try again later.
![]()
Initially this file only contains an optional header and footer for errors. At this point you can open the file and add two lines:
form.ssn=SSNerrors.required={0} is a required field.We use this message to validate-using the Struts Validation Framework-the logon form in logon.jsp to ensure that the user enters a value for the customer (SSN).
ibm.com/redbooks