To do this I used a combination of JSP and JSTL. I used JSP tags to instantiate the wrapper class and JSTL to assign the object being wrapped as follows:
<jsp:useBean id="strainWrapper" class="au.edu.apf.phenomebank.strain.StrainHelperWrapper" />
<c:set target="${strainWrapper}" property="strain" value="${mouse.strain}" />
${strainWrapper.genotypingAssays}
public class StrainHelperWrapper {
private Strain strain;
public StrainHelperWrapper() {}
public StrainHelperWrapper(Strain strain) {
this.strain = strain;
}
public Strain getStrain() {
return strain;
}
public void setStrain(Strain strain) {
this.strain = strain;
}
/**
* Returns a list of Amplifluor requirements for the Genotyping Assays
* @return
*/
public String getAmplifluors() {
StringBuilder sb = new StringBuilder();
if (strain != null) {
List<Genotype> genotyping = strain.getGenotypes();
if (genotyping != null) {
int counter = 0;
for (Genotype genotype: genotyping) {
if (counter > 0)
sb.append(", ");
String yesNo = genotype.getAmplifluor() ? "Yes" : "No";
sb.append(yesNo);
counter++;
}
}
}
return sb.toString();
}
where did mouse come from in ${mouse.strain}?
ReplyDelete