2018-03-04 web用户项目:更新数据信息

2018-03-06  本文已影响0人  紫杉叶子

笔记如下

<td>
        <a href="javascript:void(0)" onclick="confrimDel('${customer.id}')">删除</a>
        <a href="${pageContext.request.contextPath }/getonebyid?id=${customer.id}" >更新</a>                  
</td>
<body>

    <h3>客户信息修改页面</h3>

    <form action="${pageContext.request.contextPath}/update" method="post">
        <table>
            <tr>
                <td>客户编码:</td>
                <td>
                <input type="hidden" name="id" value="${customer.id}"> 
                    ${customer.id}
                </td>
            </tr>
            <tr>
                <td>姓名</td>
                <td><input type="text" name="name" value="${customer.name}">
                </td>
            </tr>
            <tr>
                <td>姓别</td>
                <td>
                    <!--- checked="checked" --> <!-- radio的回显 --> <input type="radio"
                    name="gender" value="male"
                    <c:if test="${customer.gender == 'male'}">
                        checked="checked"
                    </c:if>>男
                    <input type="radio" name="gender" value="female"
                    <c:if test="${customer.gender == 'female'}">
                        checked="checked"
                        </c:if>>女


                </td>
            </tr>
            <tr>
                <td>生日</td>
                <td><input type="text" name="birthday" id="birthday"
                    value="${customer.birthday}"></td>
            </tr>
            <tr>
                <td>邮箱</td>
                <td><input type="text" name="email" value="${customer.email}">
                </td>
            </tr>
            <tr>
                <td>手机</td>
                <td><input type="text" name="cellphone"
                    value="${customer.cellphone}"></td>
            </tr>
            <tr>
                <td>爱好</td>
                <td>
                    <!-- checkbox --> <!-- checked="checked" --> <input type="checkbox"
                    name="preference" value="弹棉花"
                    <c:if test="${fn:contains(customer.preference,'弹棉花')}">
                            checked="checked"
                        </c:if>>弹棉花

                    <input type="checkbox" name="preference" value="玩毛线"
                    <c:if test="${fn:contains(customer.preference,'玩毛线')}">
                            checked="checked"
                        </c:if>>玩毛线
                    <input type="checkbox" name="preference" value="麻辣烫"
                    <c:if test="${fn:contains(customer.preference,'麻辣烫')}">
                            checked="checked"
                        </c:if>>麻辣烫
                    <input type="checkbox" name="preference" value="敲代码"
                    <c:if test="${fn:contains(customer.preference,'敲代码')}">
                            checked="checked"
                        </c:if>>敲代码
                    <input type="checkbox" name="preference" value="睡觉"
                    <c:if test="${fn:contains(customer.preference,'睡觉')}">
                            checked="checked"
                        </c:if>>睡觉

                </td>
            </tr>
            
            <tr>
                <td>类型</td> 
                <td>
                    <!-- selected="selected" --> 
                    <select name="type">
                    
                        <option value="普通客户"
                            <c:if test="${customer.type == '普通客户'}">
                             selected="selected"
                            </c:if>
                        >普通客户</option>  
                            
                        <option value="vip客户"
                            <c:if test="${customer.type == 'vip客户'}">
                             selected="selected"
                            </c:if>
                        >VIP</option>
                        <option value="超白金客户"
                            <c:if test="${customer.type == '超白金客户'}">
                             selected="selected"
                            </c:if>
                        >超白金</option>
                        
                        
                        
                    </select>
                </td>
            </tr>
            <tr>
                <td>描述</td>
                <td>
                    <textarea rows="5" cols="75" name="description" >${customer.description}</textarea>
                    
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" value="更新">
                </td>
            </tr>
        </table>
    </form>
    
</body>

之后得到更新后的数据后在存到数据库中,并且回到查询页面.

上一篇下一篇

猜你喜欢

热点阅读