What exactly do youmean with JSP/controller configuration?
Here's the bean definition in the application contxt XML file as well as the form in the JSP responsible for rendering the data and sending the changes to the server:
Code:
Bean definition in application context:
-------------------------------------------
<bean id="dbMaintenanceFormController" class="com.siemens.checklist.controller.admin.DbMaintenanceFormController">
<property name="successView"><value>redirect:${redirectprefix.url}admin/dbMaintenanceForm.html</value></property>
<property name="formView"><value>admin/dbMaintenanceForm</value></property>
<property name="sessionForm"><value>false</value></property> <!-- it doesn't matter -->
<property name="checklistApplicationManager"><ref bean="checklistApplicationManager"/></property>
</bean>
The formBackingObject method in the controller:
----------------------------------------------
protected Object formBackingObject(HttpServletRequest request) throws Exception
{
DbMaintenanceContainer dbmc = new DbMaintenanceContainer();
List configurations = checklistApplicationManager
.getChecklistConfigurationManager().getConfiguration();
List allVirtualUserrights =
checklistApplicationManager.getAllVirtualUserrights();
dbmc.setCcItems(configurations);
dbmc.setVuItems(allVirtualUserrights);
return dbmc;
}//end formBackingObject
The JSP:
--------
<form name="configurationForm" action="" method="post">
<display:table name="${command.ccItems}" id="cConfig" uid="configs"
requestURI="dbMaintenanceForm.html"
class="checklist_table" pagesize="10"
>
<!-- The key -->
<display:column title="Key" style="width: 100px;">
<%--<spring:bind path="command.ccItems[${configs_rowNum-1}].key">
<input type="hidden" id="configKey_${configs_rowNum-1}" name="configKey_${configs_rowNum-1}" value="${status.value}" size="30"/>--%>
<c:out value="${ command.ccItems[configs_rowNum-1].key }"/>
<%--</spring:bind>--%>
</display:column>
<!-- The value -->
<display:column title="Value" style="width: 100px;">
<spring:bind path="command.ccItems[${configs_rowNum-1}].value">
<input type="hidden" id="configOldValue_${configs_rowNum-1}" name="configOldValue_${configs_rowNum-1}" value="${status.value}" size="30"/>
<input type="text" id="configValue_${configs_rowNum-1}" name="configValue_${configs_rowNum-1}" value="${status.value}" size="30" readonly="readonly"/>
</spring:bind>
</display:column>
<!-- The edit button -->
<display:column title="Edit" style="width: 50px; text-align:center;">
<input type="button" id="configEdit_${configs_rowNum-1}" name="edit" value="edit" style="text-align:center;"
onclick="enableConfigItemModification('configValue_${configs_rowNum-1}', this, 'sendEdit_${configs_rowNum-1}');"/>
<input type="submit" style="text-align:center; font-size:115%; font-weight:bold; color:green; display:none;" id="sendEdit_${configs_rowNum-1}"
name="sendEditConfig_${configuration.id}" value="send"
onclick="checkConfigInput('configOldValue_${configs_rowNum-1}', 'configValue_${configs_rowNum-1}');"/>
</display:column>
<!-- The remove button -->
<display:column title="remove" style="width: 50px;">
<input type="submit" name="removeConfigurationItem_${configs_rowNum-1}" value="remove"/>
</display:column>
</display:table>
</form
In the controller I use a helper class called DbMaintenanceContainer which currently holds two lists of distinct objects for the time being. This number of objects will surely increase in the future.
(In the beginning I used an inner class in the controller but EL was not able to access inner classes (since they are not public).)
The JSP have forms for each object (list of objects) to be displayed.
Hope this helps!?
Regareds
Dirk