M
MP
Hi everyone:
I'm having a problem getting the struts iterate to work. In my JSP I
have:
<logic:iterate id="template" name="ad_template_list"
property="templateListRecList"
type="com.package1.TemplateListRec">
<LI><bean:write name="template" property="templateId"/></LI>
</logic:iterate>
ad_template_list maps to a form bean in the struts_config.xml file
templateListRecList will call the getter method getTemplateListRecList
and returns a Hashtable which contains a key and a TemplateListRec
object.
So I set the type to be com.package1.TemplateListRec which should set
that type.
However when I run it I get the error:
Error: 404 SC_NOT_FOUND
Extension of file not found, while displaying static content
When I take out the type attribute then it runs fine and will print
the object on the screen: com.package1.TemplateListRec@244023d
So obviously the hashtable contains that object why cannot I not set
it to the type specified.
In the struts logic API it says under type: The actual elements of the
collection must be assignment-compatible with this class, or a request
time ClassCastException will occur
I think this is what is happening. This is what mine looks like:
package com.package1.adbuilder;
public final class TemplateListRec {
public TemplateListRec(String templateId, String imagePath, String
summaryText){
this.templateId = templateId;
this.imagePath = imagePath;
this.summaryText = summaryText;
}
public TemplateListRec() {
}
public String getTemplateId() { return (this.templateId); }
public void setTemplateId(String templateId) { this.templateId =
templateId; }
public String getImagePath() { return (this.imagePath); }
public void setImagePath(String imagePath) { this.imagePath =
imagePath; }
public String getSummaryText() { return (this.summaryText); }
public void setSummaryText(String summaryText) { this.summaryText
= summaryText; }
private String templateId;
private String imagePath;
private String summaryText;
}
Can anyone see why this would be happening?
Thanks in advance!
I'm having a problem getting the struts iterate to work. In my JSP I
have:
<logic:iterate id="template" name="ad_template_list"
property="templateListRecList"
type="com.package1.TemplateListRec">
<LI><bean:write name="template" property="templateId"/></LI>
</logic:iterate>
ad_template_list maps to a form bean in the struts_config.xml file
templateListRecList will call the getter method getTemplateListRecList
and returns a Hashtable which contains a key and a TemplateListRec
object.
So I set the type to be com.package1.TemplateListRec which should set
that type.
However when I run it I get the error:
Error: 404 SC_NOT_FOUND
Extension of file not found, while displaying static content
When I take out the type attribute then it runs fine and will print
the object on the screen: com.package1.TemplateListRec@244023d
So obviously the hashtable contains that object why cannot I not set
it to the type specified.
In the struts logic API it says under type: The actual elements of the
collection must be assignment-compatible with this class, or a request
time ClassCastException will occur
I think this is what is happening. This is what mine looks like:
package com.package1.adbuilder;
public final class TemplateListRec {
public TemplateListRec(String templateId, String imagePath, String
summaryText){
this.templateId = templateId;
this.imagePath = imagePath;
this.summaryText = summaryText;
}
public TemplateListRec() {
}
public String getTemplateId() { return (this.templateId); }
public void setTemplateId(String templateId) { this.templateId =
templateId; }
public String getImagePath() { return (this.imagePath); }
public void setImagePath(String imagePath) { this.imagePath =
imagePath; }
public String getSummaryText() { return (this.summaryText); }
public void setSummaryText(String summaryText) { this.summaryText
= summaryText; }
private String templateId;
private String imagePath;
private String summaryText;
}
Can anyone see why this would be happening?
Thanks in advance!