File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Regarding Logic iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Regarding Logic iterate" Watch "Regarding Logic iterate" New topic
Author

Regarding Logic iterate

sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
Hi all,

In my action class i am having code in this way

ArrayListChiefComplaints= new ArrayList();
ChiefComplaints=(ArrayList)compdao.getChiefComplaints(PatientID));
request.setAttribute("mycomplaints",ChiefComplaints);

Here I am plcaing set of ComplaintsDTO objects in the ArrayList and finally setting it to request object.

and In my jsp page..i am iterating in this way..

<logic resent name="mycomplaints" scope="request">
<bean:size id="ccount" name="mycomplaints"/>
<font color="blue">count:<bean:write name="ccount"/></font>
<logic:greaterThan name="ccount" value="0">
<logic:iterate name="mycomplaints" id="iter">
<bean efine name="iter" type="ssl.phr.patientdemographics.dto.PatientComplaintsDTO" id="com"/>
<font color="blue"> <bean:write name="com" property="complaintdesc"/>
<bean:write name="com" property="complaintsince"/>
</font>
</logic:iterate>
</logic:greaterThan>
</logic resent>

I am able to get arraylist list object,but i want have ComplaintsDTO objects and get complaintdesc ,complaintsince values printed for each complaintsDTO in the arraylist.

I am unable to iterate it.

Help me out....

Thanking you
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
<logic:iterate name="mycomplaints" id="currentComplaint" type="ssl.phr.patientdemographics.dto.PatientComplaintsDTO"/>
<bean:write name="currentComplaint" property="complaintdesc"/><br>
<bean:write name="currentComplaint" property="complaintsince"/>
</logic:iterate>
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
I m getting error like

javax.servlet.jsp.JspException: No getter method for property complaintdesc of bean currentComplaint
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:1031)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:227)

My DTO obejct is like..

package ssl.phr.patientdemographics.dto;
public class PatientComplaintsDTO
{
//member variable declaration
private int complaintId;
private int patientId;
private String complaintdesc;
private String complaintsince;
private int painscale;
private String complaintdate;

/**
* @return Returns the complaintdate.
*/
public String getComplaintDate() {
return complaintdate;
}
/**
* @param complaintdate The complaintdate to set.
*/
public void setComplaintDate(String complaintdate) {
this.complaintdate = complaintdate;
}
/**
* @return Returns the patientId.
*/
public int getPatientId() {
return patientId;
}
/**
* @param patientId The patientId to set.
*/
public void setPatientId(int patientId) {
this.patientId = patientId;
}
/**
* @return Returns the complaintId.
*/
public int getComplaintId() {
return complaintId;
}
/**
* @param complaintId The complaintId to set.
*/
public void setComplaintId(int complaintId) {
this.complaintId = complaintId;
}
/**
* @return Returns the complaintdesc.
*/
public String getComplaintDesc() {
return complaintdesc;
}
/**
* @param complaintdesc The complaintdesc to set.
*/
public void setComplaintDesc(String complaintdesc) {
this.complaintdesc = complaintdesc;
}
/**
* @return Returns the complaintsince.
*/
public String getComplaintSince() {
return complaintsince;
}
/**
* @param complaintsince The complaintsince to set.
*/
public void setComplaintSince(String complaintsince) {
this.complaintsince = complaintsince;
}

/**
* @return Returns the painscale.
*/
public int getPainScale() {
return painscale;
}
/**
* @param painscale The painscale to set.
*/
public void setpainScale(int painscale) {
this.painscale = painscale;
}
}

I cant understand the error ,even though names are correct...
help me out...
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
The problem is with the case...you need to use "complaintDesc" (with a capital D) to match up with the case of your get method.

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding Logic iterate