Back Forum Reply New

How to bind data in spring MVC

Hi,
Scenario :
I have a domain (command class)A class which contains reference of other class B and List of Class C.

How to bind the data form jsp with Class B and Attributes of Class C.
and How to decide size of listDo anybody have the sample code for the above requirement.

Assuming your FBO looks like this:Code:
public class MyFbo implements Serializable {  private B b;  private Listlt;Cgt; cList;  ...//getters for b and cList
you can access them in your JSP like this:

Code:
...
lt;spring:nestedPath path=quot;myFbo.bquot;gt;
lt;%--access members of b here --%gt;
...
lt;spring:nestedPath path=quot;myFbo.cList[0]quot;gt;
lt;%--access members of c here --%gt;
...
as far as knowing the size of the list, you could always put your code in a loop using the size of cList (using lt;c:forEachgt;)Code:
lt;c:forEach items=quot;${myFbo.cList}quot; var=quot;cquot;quot;gt;   lt;trgt;       lt;tdgt;${c.name}lt;/tdgt;       lt;tdgt;${c.address}lt;/tdgt;   lt;/trgt;
lt;/c:forEachgt;
¥
Back Forum Reply New