<%-- Mailing List Demo --%> <% java.util.HashMap valueMap = null; if (controllerResponse == null) { // Prevent null pointer errors the first time the page is called. Functions.debug("YOURNAME: ___New Run Started___"); valueMap = new java.util.HashMap(); } else { // Get the parameters passed by the controller valueMap = (java.util.HashMap)controllerResponse.getData(); } String page_control = valueMap.get("control") == null ? "init" : (String)valueMap.get("control"); Functions.debug("YOURNAME: Page is running: " + page_control); String contact_name = ""; String contact_email = ""; if (page_control != "record_added" ) { contact_name = valueMap.get("contact_name") == null ? "" : (String)valueMap.get("contact_name"); contact_email = valueMap.get("contact_email") == null ? "" : (String)valueMap.get("contact_email"); } //Controller response can also pass a message: // String message = controllerResponse == null? "" : controllerResponse.getMessage(); %> Add/Update Email Address

Add a Mailing List Entry

<% if (page_control != "update_query") { %> <% if (page_control == "record_added" ) { %> <% } else if (page_control == "record_updated") { %> <% } %> <% } else { // page_control = "update_query" String existing_name = (String)valueMap.get("existing_name"); String record_id = (String)valueMap.get("record_id"); // Extract it to pass it on %> <% } %>
Name Email

Contact added.

Contact updated.

Email address already exists. Do you want to update the name?
Existing name: <%=existing_name%>