Policy是策略,有若干属性PolicyParam,属性可能带多个可选单位Unit。
用的框架是struts2、spring2.5、jQuery。
根据PolicyParam的type不同,需要生成不同输入控件。可能是int类型,可能是radio,以后还会扩展。
由于在公司的平台上做二次开发,用的自家标签,所以对int能解析成number输入框。
Action就不展示了,就是从数据库取数据,放入request中。
FreeMarker数据源:
policyList
|
|
|--name = ""
|
|
|--display = ""
|
|
|--params
| |
| |
| |--name = ""
| |
| |
| |--display = ""
| |
| |
| |--type = ""
| |
| |
| |--policyName = ""
| |
| |
| |--units
| | |
| | |
| | |--name = ""
| | |
| | |
| | |--display = ""
框架jsp
<body> <baomi:form> <table width="100%" class="tag-win-table"> <s:iterator value="policyData" > <tr class="policy_head" id="${name }"> <td colspan="4"> <baomi:checkbox onclick="toggleDisabled(this)" id="${name }_checkbox" label="${display }" ></baomi:checkbox> </td> </tr> <s:iterator value="params" > <tr class="${policyName }_param" id="${policyName }_${name }" > <td width="20px"></td> <th width="10%" id="${policyName }_${name }_th" style="color: grey;"> <baomi:label value="%{display }:"></baomi:label> </th> <td width="160px"> <s:hidden id="%{policyName }_%{name }_type" value="%{type }" /> <s:include value="%{type }.jsp"></s:include> </td> <td> <s:if test="units != null"> <baomi:combobox disabled="true" readonly="true" id="${policyName }_${name }_unit" simpleData="units" combValue="${units[0].name }" value="${units[0].display }" valueField="name" displayField="display"> </baomi:combobox> </s:if> </td> </tr> </s:iterator> </s:iterator> </table> <baomi:button value="LOOK" onclick="lookData()"></baomi:button> </baomi:form> </body>