Trying to get hold of <spring:bind>
tag. I am trying to print a String value. The code looks somet开发者_StackOverflow中文版hing like:
mySimpleBean myBean = presentStudent.getSubjects().getTeacherName();
String firstName = myBean.getTeacherFirstName()
Where I get "myBean" from another bean "presentStudent". On jsp I am trying:
<spring:bind path="presentStudent.subjects.teacherName.teacherFirstName">
<input type="text" name="${status.expression}" value="${status.value}">
But it doesnt print anything. Also "presentStudent" is commandObject for this form:
<form:form id="stuTeachForm" name="stuTeachForm" method="post" commandName="presentStudent"
action="getStuTeachData.html">
You can use the sping input tag instead of the bind tag
<form:form id="stuTeachForm" name="stuTeachForm" method="post" commandName="presentStudent" action="getStuTeachData.html">
<form:input type="text" path="subjects.teacherName.teacherFirstName"/>
Might also be worth outputting the desired value to check your bean has been properly populated
First name is ${presentStudent.subjects.teacherName.teacherFirstName}
精彩评论