I tried as below,
Model A:
@Model(adaptables = SlingHttpServletRequest.class)
public class ModelA {
private String title;
@inject
Resource resource;
ModelB modelb;
. @PostConstruct
public void init() {
modelb = resource.adaptTo(ModelB.class);
}
}
Model B:
@Model(adaptables = SlingHttpServletRequest.class)
public class ModelB {
private String text;
}
But it's not working.
Solved! Go to Solution.
Views
Replies
Total Likes
Try this:
@Model(adaptables = SlingHttpServletRequest.class)
public class ModelA {
private String title;
@Deleted Account
ModelB modelb;
}
Or if ModelB is adaptable only from Resource then
@Model(adaptables = SlingHttpServletRequest.class)
public class ModelA {
private String title;
@Deleted Account
@Via("resource")
ModelB modelb;
}
Try this:
@Model(adaptables = SlingHttpServletRequest.class)
public class ModelA {
private String title;
@Deleted Account
ModelB modelb;
}
Or if ModelB is adaptable only from Resource then
@Model(adaptables = SlingHttpServletRequest.class)
public class ModelA {
private String title;
@Deleted Account
@Via("resource")
ModelB modelb;
}
Same result Still null
Views
Replies
Total Likes