incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Petr Kotek <ko...@crcdata.cz>
Subject Change value of SelectOneChoice in background
Date Tue, 24 Apr 2007 15:06:25 GMT
Hello all,

I have next problem with SelectOneChoice component:

1. value is binded to backing bean and taken for example from database
2. when query page, component show correct value
3. now another process change value (in database)
4. page is reloaded (by reload button in browser), then component show 
bad, old value
5. only new query for page show correct value of component

Moreover, if page is submitted (by another component), then bad old 
value of SelectOneChoice component is saved into database.

I am using latest Trinidad 1.0.1 SNAPSHOT.

Thanks for any help,
Peter



I'm simulated this in next test. Changing value by button or 
SelectOneChoice is OK. When I change value of socTestVal in session 
backing bean in debuger (simulating backgroung value change), component 
don't reflect this change, when page is only reloading.

index.jsp test page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
<f:view>
  <trh:html>
    <trh:head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title>Select One Choice Test</title>
    </trh:head>
    <trh:body>
      <tr:form id="TestForm">
        <tr:selectOneChoice autoSubmit="true" label="Selection:" 
value="#{IndexBean.socTestValue}">
          <tr:selectItem label="One" value="1"/>
          <tr:selectItem label="Two" value="2"/>
        </tr:selectOneChoice>
        <tr:commandButton text="Set One" 
actionListener="#{IndexBean.ChoiceOneAction}"/>
      </tr:form>
    </trh:body>
  </trh:html>
</f:view>


Session backing bean:

package test.backing;

import javax.faces.event.ActionEvent;

public class IndexBean {
  short socTestVal;
 
  public IndexBean() {
    socTestVal = 2;
  }
 
  public Short getSocTestValue() {
    return socTestVal;
  }
 
  public void setSocTestValue(Short newVal) {
    socTestVal = newVal.shortValue();
  }

  public void ChoiceOneAction(ActionEvent actionEvent) {
     socTestVal = 1;
  }
}




Mime
View raw message