jsp - How to pass an object to a custom tag [in Spring MVC]? -
in spring mvc, code returns modelandview model being object of class foo.
class foo has method
public zoo getzoo() in jsp view pass model object's zoo custom tag. have custom tag named doforobject, (which should reflection on passed object). corresponding tag class has
public void setobject(object object) { this.object = object; } how pass foo's zoo custom tag?
tried both this:
<my:doforobject object="${model.zoo" /> as as
<my:doforobject> <jsp:attribute name="object">${model.zoo}</jsp:attribute> </my:doforobject> and didn't work
<c:set var="obj" value="${model.zoo}" /> <my:doforobject object="${obj}" /> but in 3 cases errors when jsp invoked.
example, last attempt got error message
according tld or attribute directive in tag file, attribute object not accept expressions the model object (instance of foo) created (for simplicity) follows:
foo foo = new foo(); zoo zoo = new zoo(); foo.setzoo(zoo);
Comments
Post a Comment