aspose file tools*
The moose likes Struts and the fly likes issue with the optionsCollection,help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "issue with the optionsCollection,help" Watch "issue with the optionsCollection,help" New topic
Author

issue with the optionsCollection,help

shyam jakki
Ranch Hand

Joined: Dec 09, 2003
Posts: 37
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
Zip Ped
Ranch Hand

Joined: Jul 26, 2005
Posts: 336
Try this:

Zip Ped
Ranch Hand

Joined: Jul 26, 2005
Posts: 336
sorry I missed a colon
shyam jakki
Ranch Hand

Joined: Dec 09, 2003
Posts: 37
I already done with it, if you look at the code jsp snippet, you would know.

Help appreciated.

Regards
Shyam
shyam jakki
Ranch Hand

Joined: Dec 09, 2003
Posts: 37
I need an help on this.Anyone have done this earlier , help me to solve this issue.

Regards
Zip Ped
Ranch Hand

Joined: Jul 26, 2005
Posts: 336
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:
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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

Joined: Dec 09, 2003
Posts: 37
Hi

Thanks a lot for your help.

I have solved it.

Regards
Shyam
 
wood burning stoves
 
subject: issue with the optionsCollection,help