Now that we have it working, let's make it pretty!
Presentation - Displaying Dynamic Content
How do we integrate Struts tags into our server pages? Which tags work with data items? Which tags work with control issues? What other tags are available?
The Data and Control help us customize applications for each user.
- Tag Syntax
- Data Tags
- Control tags
- Other Tags
Workshop - Profile
Story: Subscribers can create and edit an account profile.
- Implement retrieving and updating records
- Adjust or extend page flow for new operations
- if, else tags
- hidden tag
- submit action= attribute
- Review the Profile use case.
- Implement a strategy that will allow unauthenticated clients to register with MailReader (as they can now), but will also allow authenticated users to edit his or her registration after logging into MailReader.
- You may need to subclass the Register class to configure one set of Validations for editing and another for creating. The subclass doesn't need to override any methods to have it's own ClassName-validation.xml file.
- Whether a client is authenticated can be determined by checking getUser()!=null
- One solution utilizes a Task property to set an Action property to determine if the workflow is in "Edit" or "Create" mode. Other solutions are possible.
- When editing an existing account, changing the password should be optional.
- Creating an account may require more validation than editing since a confirmation password is required. One solution is to create an empty RegisterCreate subclass to provide a place to store the extra validation.
<action name="Register_create" class="actions.RegisterCreate" method="save"> <result name="input">/pages/Register.jsp</result> <result type="redirect-action">Menu</result> </action>
- To reset the database in Eclipse, switch to Debug perspective, right-click on the Tomcat Server, and select Clean.
- You can open the deployed copy of database.xml in an editor and check its state after every change.
- To find the deployed copy, Search for "database.xml" under the .metadata folder in your workspace. For example:
C:\MRTC\labs\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ .. profile\WEB-INF\classes\database.xml
- Implemented retrieving and updating records
- Adjusted or extended page flow for new operations
- Create or extend a RegisterTest class to prove retrieve and update work
- Be sure to test the optional change of password on edit
- Create a Selenium test for editing an existing registration