單個對象數據怎麼展示到前端頁面

這個很簡單,直接上代碼

這裏通過一個接口去查詢到user主鍵爲10的數據,然後通過model模板保存並傳遞到前端,主要看前端怎麼寫,後臺我感覺不是特別難,因爲本人主要寫後臺,前端這些數據的展示一直都半懂半不懂的,所以特地來總結一下,方便以後查閱

	@RequestMapping(value = "/object.action")
	public String object(Model model) throws MessageException{
		//從Mysql中查詢
		User user = itemService.selectUser(10);
		model.addAttribute("user",user);
		return "object";
	}

 

下面是前端頁面,so esay

 

    <table>
    	<tr>
    		<td><input type="text" name="name" value="${user.username }" /></td>
    		<td><input type="text" name="name" value="${user.birthday }" /></td>
    		<td><input type="text" name="name" value="${user.sex }" /></td>
    	</tr>
    	<tr>
    		<td><input type="text" name="name" value="${user.address }" /></td>
    	</tr>
    </table>

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章