试图抓住<spring:bind>
标签。我正在尝试打印String值。代码类似于:
mySimpleBean myBean = presentStudent.getSubjects().getTeacherName();
String firstName = myBean.getTeacherFirstName()
我从另一个bean“presentStudent”获得“myBean”。在jsp上我正在尝试:
<spring:bind path="presentStudent.subjects.teacherName.teacherFirstName">
<input type="text" name="${status.expression}" value="${status.value}">
但它没有打印任何东西。
“presentStudent”也是此形式的commandObject:
<form:form id="stuTeachForm" name="stuTeachForm" method="post" commandName="presentStudent"
action="getStuTeachData.html">
答案 0 :(得分:0)
您可以使用spring输入标记代替bind标记
<form:form id="stuTeachForm" name="stuTeachForm" method="post" commandName="presentStudent" action="getStuTeachData.html">
<form:input type="text" path="subjects.teacherName.teacherFirstName"/>
也可能值得输出所需的值来检查你的bean是否已正确填充
First name is ${presentStudent.subjects.teacherName.teacherFirstName}