日期:2014-05-20  浏览次数:20749 次

Struts2表单数据清空问题,求一个好的设计方法,解决数据绑定
HTML code

  <s:form action="list_acctList.action" theme="simple" name="user" namespace="/jsp" onsubmit="change()">
                    <table width="30%" height="30%" id="search">
                        <tr>
                            <td colspan="2">
                                <input type="submit" value="高级搜索">
                            </td>
                            <td>
                                <s:reset  value="清空查询" onclick="clearInput();"></s:reset>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                账户类型:
                            </td>
                            <td colspan="2">
        <s:radio id="cleart" list="#{'a':'信用账户','b':'普通账户'}" name="pageView.accountType"value="#request.pv.accountType"theme="simple"/> 
                            </td>
                        </tr>
                        <tr>
                            <td>
                                账户状态:
                            </td>
                            <td colspan="2">
    <s:radio id="clears" list="#{'0':'冻结','1':'正常'}" name="pageView.accountState" value="#request.pv.accountState" theme="simple"/> 
                            </td>
                        </tr>
                        <tr>
                            <td>
                                余额范围:
                            </td>
                            <td>
    <input type="text" name="pageView.lowbalance" value="<s:property value="#request.pv.lowbalance" />">
                                元
                            </td>
                            <td>
    <input type="text" name="pageView.highbalance" value="<s:property value="#request.pv.highbalance" />">
                                元
                            </td>
                        </tr>
                        <tr>
                            <td>
                                信用范围:
                            </td>
                            <td>
    <input type="text" name="pageView.lowceiling" value="<s:property value="#request.pv.lowceiling" />">
                                元
                            </td>
                            <td>
    <input type="text" name="pageView.highceiling" value="<s:property value="#request.pv.highceiling" />">
                                元
                            </td>
                        </tr>
                        <tr>
                            <td>
                                精确搜索
                            </td>
                            <td>
                                用户姓名
    <input type="text" name="pageView.username" value="<s:property value="#request.pv.username" />">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                精确搜索
                            </td>
                            <td>
                                用户卡号
                            </td>
    <input type="text" name="pageView.accountId" value="<s:property value="#request.pv.accountId" />">
                            </td>
                        </tr>
                    </table>
                    <!-- 分页Button Begin -->
                    <input type="hidden" name="id" value="<%=request.getAttribute("id")%>">
                <%
                    if (allRecorders > 0) {
                %>
                <input type="button" value="首页" onClick="openPage(1)"
                    <%=currentPage == 1 ? "disabled" : ""%>>
                <input type="button" value="上一页"
                    onClick="openPage(<%=currentPage - 1%>)"
                    <%=currentPage == 1 ? "disabled" : ""%>>
                <input type="button" value="下一页"
                    onClick="openPage(<%=currentPage + 1%>)"
                    <%=currentPage == pageSize ? "disabled" : ""%>>
                <input type="button" value="尾页" onClick="openPage(<%=pageSize%>)"
                    <%=currentPage == pageSize ? "disabled" : ""%>>
                <input type="hidden" name="cp" value="">
                <font color="red" size="5"><%=currentPage%></font> /
                <font color="red" size="5"><%=pageSize%></font> 跳转到
                <select name="selpage" onChange="selOpenPage()">
                    <%
                        for (int x = 1; x <= pageSize; x++) {
                    %>
                    <option value="<%=x%>" <%=currentPage == x ? "selected" : ""%>><%=x%></option>
                    <%
                        }
                    %>
                </select>
                页
                <%
                    }
                %>
                
                <!-- 分页Button End -->
                </s:form>