开发者

Spring MVC spring:bind tag

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}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜