
<%@page import="java.util.*" %>

<%
Object[] methodPropertyGetParams = new Object[] {null};
pageContext.setAttribute("methodPropertyGetParams", methodPropertyGetParams);
Object[] methodPropertySetParams = new Object[] {null, null};
pageContext.setAttribute("methodPropertySetParams", methodPropertySetParams);
pageContext.setAttribute("serviceBean", serviceBean);

serviceBean.setMethodName("getPropertyKeys");
serviceBean.setMethodParamClasses(null);
serviceBean.setMethodParams(null);
String[] keys = (String[] )serviceBean.getMethodResult();
%>
<c:if test="${param.action=='save'}">
    <%
    serviceBean.setMethodName("setProperty");
    serviceBean.setMethodParamClasses("java.lang.String,java.lang.String");
    serviceBean.setMethodParams(methodPropertySetParams);
    for(int i=0; i<keys.length; i++) {
        String key = keys[i];
        methodPropertySetParams[0] = key;
        if(request.getParameter(key)==null) continue;
        methodPropertySetParams[1] = request.getParameter(key);
        serviceBean.getMethodResult();
    }
    %>
</c:if>
<table border=0>
    <%
    serviceBean.setMethodName("getProperty");
    serviceBean.setMethodParamClasses("java.lang.String");
    serviceBean.setMethodParams(methodPropertyGetParams);
//    String[] keys = serviceBean.getPropertyKeys();
    for(int i=0; i<keys.length; i++) {
        String key = keys[i];
        methodPropertyGetParams[0] = key;
        %>
        <FORM ACTION="<c:out value='${alias}'/>/selector.jsp?view=configure" METHOD=GET>
        <tr>
            <td><%=key%></td>
            <td>
                <INPUT TYPE=HIDDEN name="service" value="edu.columbia.print.ninja.core.service.Admin">
                <INPUT TYPE=HIDDEN name="sid" value="<%=request.getParameter("sid")%>">
                <INPUT TYPE=HIDDEN name="type" value="HTML">
                <INPUT TYPE=HIDDEN name="view" value="configure">
                <INPUT TYPE=HIDDEN NAME="action" VALUE="save">
                <INPUT TYPE="text" NAME="<%=key%>" SIZE=32 VALUE="<%=serviceBean.getMethodResult()%>">
            </td>
            <td>
                <INPUT TYPE=SUBMIT VALUE="Save">
            </td>
        </tr>
        </FORM>
        <%
    }
    %>
</table>
