• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

issue with the optionsCollection,help

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

The following ones are my sample ones, but when I'm using optionsCollection with the property attribute it gives an error saying that "No getter method available for property label for bean under name com.mreddy.sample.DepartmentUtil" . Pls let me know how to solve this issue ASAP.

I have in jsp the following tag Custome tag (dataSet and DatSource tags)

ds ataSet var="DepartmentSet">
<ds ataSource name="com.mreddy.sample.DepartmentDS">
<ds:argument name="TYPE_OF_ELEMENTS_IN_DATA_ARGUMENT_NAME" value="DepartmentUtil" />
</ds ataSource>
</ds ataSet>

Departments :<html:select property="departmentListSelection">
<html ptionsCollection name="DepartmentSet" property="departments" />
</html:select>

And in DepartmentUtil.java file I have the following code


public class DepartmentUtil implements Serializable{
private String deptNo;
private String dName;
private String loc;

public DepartmentUtil() {super();
}

public DepartmentUtil(String deptNo,String dName,String loc) {
this.deptNo = deptNo;
this.dName = dName;
this.loc = loc;
}

public String getDeptNo() {
return deptNo;
}

public void setDeptNo(String deptNo) {
this.deptNo = deptNo;
}

public String getDName() {
return dName;
}

public void setDName(String dName) {
this.dName = dName;
}
public String getLoc(){
return loc;
}
public void setLoc(String loc){
this.loc=loc;
}
static ArrayList departments = new ArrayList();
static {
departments.add(new DepartmentUtil("A10","DEV","A1"));
departments.add(new DepartmentUtil("B10","Arch","B1"));
departments.add(new DepartmentUtil("C10","DA","C1"));
departments.add(new DepartmentUtil("D10","BA","D1"));
}

public static ArrayList getDepartments(){
return departments;
}


}

And I created a dataSource DepartmentDS.java class

public class DepartmentDS implements DataSource{

//private EmployeeRAS employeeRAS;
//private Department dept;
private Criteria criteria;
private List depts;
private UtilBean utilbean;
private DepartmentUtil deptutil;

public List getData(Criteria criteria) throws Exception {

String elementsInData = getArgumentValue(criteria.getQuery().getArguments(),TYPE_OF_ELEMENTS_IN_DATA_ARGUMENT_NAME );
String kindOfData=getArgumentValue(criteria.getQuery().getArguments(),KIND_OF_DATA_ARGUMENT_NAME );

return DepartmentUtil.getDepartments();

}
private String getArgumentValue(Map arguments, String key){
if (arguments == null) {
return null;
}
List values = (List) arguments.get(key);

if (values != null) {
return (String) values.get(0);
}
else{
return null;
}
}
}

And I have the ActionForm and Action classes as usual. Please advise.

Regards
Shyam
 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:

 
Zip Ped
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry I missed a colon
 
shyam jakki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already done with it, if you look at the code jsp snippet, you would know.

Help appreciated.

Regards
Shyam
 
shyam jakki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need an help on this.Anyone have done this earlier , help me to solve this issue.

Regards
 
Zip Ped
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am unable to figure out what your custom tag is doing. Could you give an explaination.
I know I asked you earlier but did you try putting this code in your JSP:
 
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 suggestion by Kailash looks correct to me. If you do not give the label and value attributes then the tag will call getLabel() and getValue(). In this case the object is DepartmentUtil which does not have these methods.

- Brent

P.S. The "Disable smilies in this post" option can be really helpful.
 
shyam jakki
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thanks a lot for your help.

I have solved it.

Regards
Shyam
 
reply
    Bookmark Topic Watch Topic
  • New Topic