SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 581 | Next

Larry Brown, Marty Hall, and Yaakov Chaikin

"Core Servlets and JavaServer Pages, Volume 2"


11.1 Using Properties Files 541
Form Action
JSP
JSP
struts-config.xml
Determine
Action
Choose
JSP Page
request.../SomeForm.jsp
submit form
request.../blah.do
invoke execute
method
return condition
forward to
return final result
Use bean:write to output bean
properties. Use bean:message
to output fixed strings.
Populate bean and pass
to execute method.
Use html:form to build the
form. Use bean:message
to output fixed strings.
Figure 11??“1 Flow of request through the Struts framework with updates for using properties files. In both the input page and output
pages, the bean:message tag can display messages from the properties file.
Chapter 11 ?–  The Struts Framework: Doing More 542
Steps for Using Properties Files
Next, we summarize the changes needed in your application to support properties
files. These changes have four essential steps.
1. Create a properties file in WEB-INF/classes. Place a properties
file named MessageResources.properties in the WEB-INF/classes
directory.
2. Define strings in the properties file. Add messages to your properties
file for later display on your JSP pages.
3. Load the properties file in struts-config.xml. So that Struts
knows about the properties file, you must place a resource file definition
in struts-config.xml.
4. Output the messages in JSP pages. To display the messages in your
JSP pages, load the Struts bean tag library and output the messages
using bean:message.


Pages:
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593