1
votes

I have created a little XPage search form with a backing bean. This works great with strings, everything is bound using Expression Language and I can access the value in my bean to compose the actual search string.

However, this doesn't seem to be working for dates. I have a date field that looks like this:

<xp:inputText
    themeId="Field.Date"
    id="inputStartDate" value="#{Search.calStart}">
    <xp:this.converter>
        <xp:convertDateTime type="date"></xp:convertDateTime>
    </xp:this.converter>
</xp:inputText>

My bean has a very basic getter/setter for this:

public Date getCalStart() {
    return calStart;
}

public void setCalStart(Date calStart) {
    this.calStart = calStart;
}

The problem is that while the field will populate from the backing bean, the bean is not affected by the field. So if in my constructor I set a date field to 7/18/2014, it looks fine on my page. But if I pick a date on the page and perform a refresh, the value does not change in the bean. The dates remain null or whatever I've initialized them to in the bean.

Is there something about the converter (other than handling it as a Java Date in my bean, which I'm doing) that breaks the value binding?

1
it looks ok. How are you doing the refresh? is it from a submit button? Is it a full page refresh or a partial refresh? Also just to double check the getter is accessing your bean, if you change your initial value to a date in the past in the constructor, does the new value show up? I think sometimes today's date shows up as default depending on domino versionCameron Gregor
also can you check the import statement in your bean, is it definitely java.util.Date? sometimes the IDE will choose java.sql.Date and things like thatCameron Gregor
Just checking... it does work fine without the converter right?David Leedy
Thanks for all these responses. @CameronGregor - I have buttons trying just a partial refresh and a full refresh. I'm fairly certain I was using java.util.Date.Gary Forbis
@DavidLeedy - I just removed the converter from the xsp and changed everything in my bean over to String and it works perfectly.Gary Forbis

1 Answers

0
votes

I have had this problem with Date and Beans before but not in Xpages.
What I did was to circumvent the getter/setter with my own and within those convert to the format I want.