小编Bhu*_*ary的帖子

Spring mvc <form:input>标记,其中一些值从modelAttribute中的调用控制器传递

我在Spring MVC 3中创建了CRUD应用程序.除了编辑页面之外,每个东西都工作正常.我希望我的编辑页面中填充了一些带有相关数据库生成值的标签,因此我可以查看,编辑是否需要并保存它们.我传递了modelAttribute中的值列表以与edit.jsp共享.我可以在edit.jsp上检索它们的值,但是我无法将这些值放在tag中,因为它没有value属性.请帮忙.

Sharing the code below----------------------------

    enter code here
<form:form id="form5" commandName="user" action="modify.htm">
<table>
    <tr>
        <th>Name</th>
        <th>Age</th>
    </tr>
    <c:forEach items="${userList}" var="user">
        <tr>
            <td> <form:input path="name" value="${user.name}"/></td>
            <td><form:input path="age" value="{user.age}"/></td>
        </tr>
    </c:forEach>
    <tr><td><button type="button" onclick="modify()">Save</button></td></tr>
</table>
</form:form>
Run Code Online (Sandbox Code Playgroud)

spring-mvc

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

spring-mvc ×1