Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Regarding Logic iterate

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<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
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic