<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>
<app:checkLogon/>
<%-- In real life, these would be loaded from a database --%>
<%
java.util.ArrayList list = new java.util.ArrayList();
list.add(new org.apache.struts.example.LabelValueBean("IMAP Protocol", "imap"));
list.add(new org.apache.struts.example.LabelValueBean("POP3 Protocol", "pop3"));
pageContext.setAttribute("serverTypes", list);
%>
<logic:equal name="subscriptionForm" property="action"
scope="request" value="Create">
<bean:define id="title" value="subscription.title.create"/>
</logic:equal>
<logic:equal name="subscriptionForm" property="action"
scope="request" value="Delete">
<bean:define id="title" value="subscription.title.delete"/>
</logic:equal>
<logic:equal name="subscriptionForm" property="action"
scope="request" value="Edit">
<bean:define id="title" value="subscription.title.edit"/>
</logic:equal>
<layout:html key='<%= pageContext.findAttribute("title").toString() %>' styleClass="FORM">
<layout:form action="/saveSubscription.do" focus="host" styleClass="FORM">
<html:hidden property="action"/>
<layout:field key="prompt.username" name="user" property="username" access="READONLY" styleClass="LABEL"/>
<layout:field key="prompt.mailHostname" property="host" cols="50" rows="1" type="textarea" styleClass="LABEL" isRequired="true"/>
<layout:field key="prompt.mailUsername" property="username" size="50" isRequired="true" styleClass="LABEL"/>
<layout:field key="prompt.mailPassword" property="password" size="50" type="password" styleClass="LABEL" isRequired="true"/>
<layout:select key="prompt.mailServerType" property="type" styleClass="LABEL">
<layout:options property="value" collection="serverTypes" labelProperty="label"/>
</layout:select>
<layout:field key="prompt.autoConnect" property="autoConnect" type="checkbox" styleClass="LABEL"/>
<layout:formActions name="subscriptionForm" property="action" key="button"/>
</layout:form>
</layout:html>