Custom request bean problem

I create a custom request bean with some properties, but it isn't listed in the binding target list when binding component to data. Custom session bean is ok.
[166 byte] By [hugebrush] at [2007-11-26 10:12:07]
# 1
This is a known bug. The work around is to type in the bindings.For example:#{MyRequestBean.reportName}
jetsons at 2007-7-7 1:59:50 > top of Java-index,Development Tools,Java Tools...
# 2
The work around cause the page design view error if the request bean property is type of subclass of ObjectListDataProvider.
hugebrush at 2007-7-7 1:59:50 > top of Java-index,Development Tools,Java Tools...
# 3

> The work around cause the page design view error if

> the request bean property is type of subclass of

> ObjectListDataProvider.

What is the design view error? Why do you think this error, whatever it is, is because the request bean property is of a type that is a subclass of the object list data provider?

I tried to recreate your problem and cannot duplicate it. It works fine for me.

1. I created a class

public class Color {

public Color(String name, String srgb) {

this.name = name;

this.srgb = srgb;

}

private String name;

public String getName() {

return this.name;

}

public void setName(String name) {

this.name = name;

}

private String srgb;

public String getSrgb() {

return this.srgb;

}

public void setSrgb(String srgb) {

this.srgb = srgb;

}

}

2. I created a data provider:

public class ColorDataProvider extends ObjectListDataProvider{

private List colorList = new ArrayList();

public ColorDataProvider() {

colorList.add(new Color("red", "#FF0000"));

colorList.add(new Color("green", "#00FF00"));

colorList.add(new Color("blue", "#0000FF"));

colorList.add(new Color("yellow", "#FFFF00"));

// Set the List that the data provider the wrapper for.

// In addition, the objectType property is reset based on

// the class of the first element in the list (if any).

// Note that if the list was empty, which it is not

// in this case, the objectType is set to null.

this.setList(colorList);

}

}

3. I created a custom request bean named ColorRequestBean and added a property for the color data provider:

private ColorDataProvider colorDataProvider = new ColorDataProvider();

public ColorDataProvider getColorDataProvider() {

return this.colorDataProvider;

}

public void setColorDataProvider(ColorDataProvider colorDataProvider) {

this.colorDataProvider = colorDataProvider;

}

4. I pressed ctrl-shift-B to clean and build.

5. I closed and reopened the project (a workaround for an object list data provider bug)

6. I added a List component to the page and set the JSP code as follows

<ui:listbox binding="#{Page1.listbox1}" id="listbox1"

items="#{ColorRequestBean.colorDataProvider.options['srgb,name']}"

style="position: absolute; left: 288px; top: 48px"/>

Notice how the items settting is a little different from what I showed you before. This is because it is a list component and thus requires both a return value and a display value. You have to adjust your manual settings to conform to the needs of the particular component.

Can you now post a similar post that shows how to recreate your problem?

Thanks,

Chris

jetsons at 2007-7-7 1:59:50 > top of Java-index,Development Tools,Java Tools...
# 4
Thanks.The design view error is caused by ObjectListDataProvider bug , not custom request bean.
hugebrush at 2007-7-7 1:59:50 > top of Java-index,Development Tools,Java Tools...
# 5
So I am assuming that doing a clean build, then closing and reopening the project fixed your problem?
jetsons at 2007-7-7 1:59:50 > top of Java-index,Development Tools,Java Tools...