Dashboard > Struts University > Home > MailReader Training Course > Topics > Subscribe-Notes
Subscribe-Notes
Added by Ted Husted, last edited by Ted Husted on Jan 21, 2007  (view change)
Labels: 
(None)


Now that we have it working, let's make it pretty!

Presentation - Polishing the User Interface

Are UI tags useful for HTML designers? What UI tags are available? Can we design our own tags?

The Data and UI tags range from the mundane to the insane.

  • Kinder, Gentler Forms
  • Under the Covers
  • Examples

Workshop - Subscribe

Story: Subscribers can maintain a set of email subscriptions for an account.

  • Utilize iterator tag to display a dynamic list of entries
  • Link to each item on list

Prerequisites

  • iterator
  • property
  • param
  • select
  • checkbox
  • Preparable

Exercises

  • Review the Subscribe use case
  • Copy the MailreaderSupport class from the Subscribe solution
  • Extend the Register page to display the user's current subscriptions
    • The subscriptions are already part of the user object
  • Link each subscription to a Subscribe action with an edit alias
  • Create a Subscribe page to display or edit the detail of a selected subscription
  • Place a Add link after the Subscription table that invokes Subscribe

Hint Code

  • The Subscribe form includes a drop down list.
    A prepare method can be used to setup the list of server types.
public class Subscribe extends MailReaderSupport
    implements Preparable {
    
    private Map types = null;
    
    public Map getTypes() {
    return types;
    }
    
    public void prepare() {
    
    Map m = new LinkedHashMap();
    m.put("imap", "IMAP Protocol");
    m.put("pop3", "POP3 Protocol");
    types = m;
    
    setHost(getSubscriptionHost());
    
    }

Other Hints

  • Since Struts 2 supports "stateful" checkboxes, no special handling is needed for checkboxes
  • If a submit fails, and the input page displays, but there are no error messages, check to see if the field names match. If there is no field name corresponding to a field-validator, then there is no place for the message to display.

Accomplishments

  • Utilized iterator tag to display a dynamic list of entries
  • Linked to each item on list

Extra Credit

  • Implement a Delete Subscription operation.
    • Display the Subscription as read-only text to confirm the deletion.
      • Use the label tag

Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators