1. 程式人生 > >jsp----從後臺傳過來的資料預設展示到前臺jsp頁面

jsp----從後臺傳過來的資料預設展示到前臺jsp頁面

<form action="${pageContext.request.contextPath}/userInfo/edit" method="post">
<div class="top_form">
            <div class="username">
                <span>暱稱:</span>
                <input type="text" name="userName" placeholder="${user.userName }"/>
            </div>
            <div class="useremail">
                <span>郵箱:</span>
                <input type="text" name="userEmail" placeholder="${user.userEmail }"/>
            </div>
            <div class="sex">
                <span>性別:</span>
                <input type="radio" value="0" name="userGender"/>男
                <input type="radio" value="1" name="userGender"/>女
            </div>
            <div class="age">
                <span>生日:</span>
                <select name="birthday" id="year" onchange="changeday()">
                    <option value="${bir[0] }">${bir[0] }</option>
                </select>
                <select name="birthday" id="month" onchange="changeday()">
                    <option value="${bir[1] }">${bir[1] }</option>
                </select>
                <select name="birthday" id="day">
                    <option value="${bir[2] }">${bir[2] }</option>
                </select>
            </div>
            <div class="edurank">
                <span>學歷:</span>
                <select name="userEducation">
                    <option value="${user.userEducation }" selected="selected">${user.userEducation }</option>
                    <option value="小學">小學</option>
                    <option value="初中">初中</option>
                    <option value="高中">高中</option>
                    <option value="本科">本科</option>
                    <option value="專科">專科</option>
                    <option value="研究生">研究生</option>
                    <option value="博士生及以上">博士生及以上</option>
                </select>
            </div>
            <div class="work">
                <span>職業:</span>
                <select name="userWork">
                    <option value="${user.userWork }" selected="selected">${user.userWork }</option>
                    <option value="學生">學生</option>
                    <option value="會計">會計</option>
                    <option value="IT">IT</option>
                    <option value="醫生">醫生</option>
                    <option value="老師">老師</option>
                    <option value="律師">律師</option>
                    <option value="其他">其他</option>
                </select>
            </div>
            <div class="address">
                <span>地址:</span>
                <select id="cmbProvince" name="address_province"></select>    
                <select id="cmbCity" name="address_city"></select>    
                <select id="cmbArea" name="address_area"></select>    
                <script type="text/javascript">    
                    addressInit('cmbProvince', 'cmbCity', 'cmbArea');    
                </script>
            </div>
            <div class="userphone">
                <span>手機號:</span>
                <input type="text" name="userPhoneNumber" placeholder="${user.userPhoneNumber }"/>
            </div>
        </div>
        <div class="top_select">
            <div class="infor"><p>興趣愛好</p></div>
            <div class="mixselect">
                <c:forEach items="${listPublicTypeP }" var="courseType">
                        <label class="demo--label"> 
                            <input class="demo--radio" type="checkbox" name="publicTypeName" value="${courseType.publicTypeName }"/>
                            <span class="demo--checkbox demo--radioInput"></span>${courseType.publicTypeName }
                        </label>                
                </c:forEach>
            </div>
            <div class="tijiao">
                <input type="submit" name="提交" value="儲存">
            </div>
        </div>
    </form> 

input 標籤中新增:placeholder=”${user.userName }”