Search code examples
xpagesmanaged-bean

xpages managed bean property of an array returns the reference instead of the values


must be a rookies problem:

in a managed bean i want to put values of a multivalue notes item into a bean variable:

my snippet goes like:

private String[] typevalues;

public void setTypevalues(String[] typevalues) {
    this.typevalues = typevalues;
}

public String[] getTypevalues() {
    return typevalues;
}

and in the loadPreferences function I do sth like:

        Vector <String> vt = profdoc.getItemValue("ideetypes");
        typevalues = vt.toArray(new String[vt.size()]);

(didn't find a better way to bring a getItemValue vector into an Array)

on the xpage my test item:

                <xp:text escape="true" id="computedField1"
                    value="#{APr.typevalues}">
                </xp:text>

doesn't show the values of that String array, but it's reference like [Ljava.lang.String;@74987498

Am I missing sth, or is a String[] Array the wrong container for such a bean property?

thanks in advance, Uwe


Solution

  • I like using ArrayList and not Arrays. Then you can use the following to convert from a Vector to the ArrayList.

    Collections.list( rtnVector.elements())
    

    Howard