You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Paul van Rossem <pa...@timeware.nl> on 2008/03/06 12:17:30 UTC

[trinidad] question about versus behaviour.

Why takes no rendering takes place during the render response phase 
after clicking the listbox. Or is there a bug?
<h:selectOneListbox> does what I would expect, while 
<tr:selectOneListbox> doesn't.

I have the following simple jsf:

<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root version="2.0"
  xmlns:jsp="http://java.sun.com/JSP/Page"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
   xmlns:tr="http://myfaces.apache.org/trinidad">
<jsp:directive.page contentType="text/html; charset=utf-8"/>
  <f:view>
    <tr:document title="applying listbox values">
      <tr:outputText value="clicking item in listbox doesn't update 
outputText below:"/>
      <tr:form>
        <tr:panelFormLayout>
          <tr:selectOneListbox label="item list:" value="#{bean.item}" 
size="4"
              valueChangeListener="#{bean.itemSelected}" autoSubmit="true">
            <f:selectItems value="#{bean.items}"/>
          </tr:selectOneListbox>
        </tr:panelFormLayout>
        <tr:outputText value="Selected: #{bean.item}"/>
      </tr:form>
    </tr:document>
  </f:view>
</jsp:root>

and the following in the bean:

package nl.timeware.vrtsim.beans;
import java.util.*;
import javax.faces.event.ValueChangeEvent;
public class Bean
{  
  private Integer selectedItem = 1;

  public Integer getItem()
  {  System.out.println("getItem(): " + selectedItem);
    return selectedItem;
  }

  public void setItem(Integer id)
  {  System.out.println("setItem(" + id +")");
    selectedItem = id;
  }
 
  public Map<String, Integer> getItems()
  {  System.out.println("getItem(): " + selectedItem);
    Map<String, Integer> itemMap = new TreeMap<String, Integer>();
    itemMap.put("Item 1", 1); itemMap.put("Item 2", 2); 
itemMap.put("Item 3", 3);
    return itemMap;
  }
 
  public void itemSelected(ValueChangeEvent event)
  {  System.out.println("itemSelected(" + event.getNewValue() +")");
    selectedItem = (Integer)event.getNewValue();
  }
}

If I click on one of the items, the following happens:

PhaseTracker.beforePhase(): RESTORE_VIEW 1
PhaseTracker.afterPhase(): RESTORE_VIEW 1
PhaseTracker.beforePhase(): RENDER_RESPONSE 6
getItem(): 1
getItem(): 1
getItem(): 1
PhaseTracker.afterPhase(): RENDER_RESPONSE 6
 -- this is where I click the second item in the list --
PhaseTracker.beforePhase(): RESTORE_VIEW 1
PhaseTracker.afterPhase(): RESTORE_VIEW 1
PhaseTracker.beforePhase(): APPLY_REQUEST_VALUES 2
PhaseTracker.afterPhase(): APPLY_REQUEST_VALUES 2
PhaseTracker.beforePhase(): PROCESS_VALIDATIONS 3
getItem(): 1
getItem(): 1
itemSelected(2)
PhaseTracker.afterPhase(): PROCESS_VALIDATIONS 3
PhaseTracker.beforePhase(): UPDATE_MODEL_VALUES 4
setItem(2)
PhaseTracker.afterPhase(): UPDATE_MODEL_VALUES 4
PhaseTracker.beforePhase(): INVOKE_APPLICATION 5
PhaseTracker.afterPhase(): INVOKE_APPLICATION 5
PhaseTracker.beforePhase(): RENDER_RESPONSE 6
-- why isn't getItem() called here to render the outputText ? --  <<<<<
PhaseTracker.afterPhase(): RENDER_RESPONSE 6

What suprises me is that during the 2nd RENDER_RESPONSE phase never the 
current value of the list is retrieved (Bean.getItem() is never called) 
to render the outputText, with the result that it retains its now 
obsolete value. getItem() is called in other phases, but that's of 
course before its value was changed.

When I replace the <tr:selectOneListbox> by the <h:selectOneListbox> 
things work as expected and the outputText is correctly updated.
Any suggestions what I should change or should I file a JIRA issue? I am 
using trinidad with jsf-1.2_07-b03-FCS.

Thanks for any help, Paul.

[Trinidad] tr:showDetailItem not PPR-capable?

Posted by wo...@pta.de.



Hi,

when trying to do PPR on a showDetailItem component I get the warning

WARNING: No PPR-capable 'id' found for elements of
CoreShowDetailItem[UINodeFacesBean, id=detailDataAreaId]. This component
has not written-out an 'id' attribute.

(also the partial page refresh is not done).

despite the doc saying that the attribute partialTriggers can be used.

Is the doc incorrect and the attribute wrong? Or has showDetailItem a bug?

Thanks,
Wolfgang.

PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1554 Erfahrungsberichten aus 39 Jahren erfolgreicher Projektarbeit!
**********************************************************************

Re: [trinidad] question about versus behaviour.

Posted by Paul van Rossem <pa...@timeware.nl>.
Hi Andrew,

Sorry, forgot to include that. No, the bean is session scoped.

Regards and thanks for your time!
Paul.


Andrew Robinson wrote:
> Is your #{bean} request scoped?
>
> On Thu, Mar 6, 2008 at 4:17 AM, Paul van Rossem <pa...@timeware.nl> wrote:
>   
>> Why takes no rendering takes place during the render response phase
>>  after clicking the listbox. Or is there a bug?
>>  <h:selectOneListbox> does what I would expect, while
>>  <tr:selectOneListbox> doesn't.
>>
>>  I have the following simple jsf:
>>
>>  <?xml version="1.0" encoding="UTF-8" ?>
>>  <jsp:root version="2.0"
>>   xmlns:jsp="http://java.sun.com/JSP/Page"
>>   xmlns:f="http://java.sun.com/jsf/core"
>>   xmlns:h="http://java.sun.com/jsf/html"
>>    xmlns:tr="http://myfaces.apache.org/trinidad">
>>  <jsp:directive.page contentType="text/html; charset=utf-8"/>
>>   <f:view>
>>     <tr:document title="applying listbox values">
>>       <tr:outputText value="clicking item in listbox doesn't update
>>  outputText below:"/>
>>       <tr:form>
>>         <tr:panelFormLayout>
>>           <tr:selectOneListbox label="item list:" value="#{bean.item}"
>>  size="4"
>>               valueChangeListener="#{bean.itemSelected}" autoSubmit="true">
>>             <f:selectItems value="#{bean.items}"/>
>>           </tr:selectOneListbox>
>>         </tr:panelFormLayout>
>>         <tr:outputText value="Selected: #{bean.item}"/>
>>       </tr:form>
>>     </tr:document>
>>   </f:view>
>>  </jsp:root>
>>
>>  and the following in the bean:
>>
>>  package nl.timeware.vrtsim.beans;
>>  import java.util.*;
>>  import javax.faces.event.ValueChangeEvent;
>>  public class Bean
>>  {
>>   private Integer selectedItem = 1;
>>
>>   public Integer getItem()
>>   {  System.out.println("getItem(): " + selectedItem);
>>     return selectedItem;
>>   }
>>
>>   public void setItem(Integer id)
>>   {  System.out.println("setItem(" + id +")");
>>     selectedItem = id;
>>   }
>>
>>   public Map<String, Integer> getItems()
>>   {  System.out.println("getItem(): " + selectedItem);
>>     Map<String, Integer> itemMap = new TreeMap<String, Integer>();
>>     itemMap.put("Item 1", 1); itemMap.put("Item 2", 2);
>>  itemMap.put("Item 3", 3);
>>     return itemMap;
>>   }
>>
>>   public void itemSelected(ValueChangeEvent event)
>>   {  System.out.println("itemSelected(" + event.getNewValue() +")");
>>     selectedItem = (Integer)event.getNewValue();
>>   }
>>  }
>>
>>  If I click on one of the items, the following happens:
>>
>>  PhaseTracker.beforePhase(): RESTORE_VIEW 1
>>  PhaseTracker.afterPhase(): RESTORE_VIEW 1
>>  PhaseTracker.beforePhase(): RENDER_RESPONSE 6
>>  getItem(): 1
>>  getItem(): 1
>>  getItem(): 1
>>  PhaseTracker.afterPhase(): RENDER_RESPONSE 6
>>   -- this is where I click the second item in the list --
>>  PhaseTracker.beforePhase(): RESTORE_VIEW 1
>>  PhaseTracker.afterPhase(): RESTORE_VIEW 1
>>  PhaseTracker.beforePhase(): APPLY_REQUEST_VALUES 2
>>  PhaseTracker.afterPhase(): APPLY_REQUEST_VALUES 2
>>  PhaseTracker.beforePhase(): PROCESS_VALIDATIONS 3
>>  getItem(): 1
>>  getItem(): 1
>>  itemSelected(2)
>>  PhaseTracker.afterPhase(): PROCESS_VALIDATIONS 3
>>  PhaseTracker.beforePhase(): UPDATE_MODEL_VALUES 4
>>  setItem(2)
>>  PhaseTracker.afterPhase(): UPDATE_MODEL_VALUES 4
>>  PhaseTracker.beforePhase(): INVOKE_APPLICATION 5
>>  PhaseTracker.afterPhase(): INVOKE_APPLICATION 5
>>  PhaseTracker.beforePhase(): RENDER_RESPONSE 6
>>  -- why isn't getItem() called here to render the outputText ? --  <<<<<
>>  PhaseTracker.afterPhase(): RENDER_RESPONSE 6
>>
>>  What suprises me is that during the 2nd RENDER_RESPONSE phase never the
>>  current value of the list is retrieved (Bean.getItem() is never called)
>>  to render the outputText, with the result that it retains its now
>>  obsolete value. getItem() is called in other phases, but that's of
>>  course before its value was changed.
>>
>>  When I replace the <tr:selectOneListbox> by the <h:selectOneListbox>
>>  things work as expected and the outputText is correctly updated.
>>  Any suggestions what I should change or should I file a JIRA issue? I am
>>  using trinidad with jsf-1.2_07-b03-FCS.
>>
>>  Thanks for any help, Paul.
>>
>>     


Re: [trinidad] question about versus behaviour.

Posted by Andrew Robinson <an...@gmail.com>.
Is your #{bean} request scoped?

On Thu, Mar 6, 2008 at 4:17 AM, Paul van Rossem <pa...@timeware.nl> wrote:
> Why takes no rendering takes place during the render response phase
>  after clicking the listbox. Or is there a bug?
>  <h:selectOneListbox> does what I would expect, while
>  <tr:selectOneListbox> doesn't.
>
>  I have the following simple jsf:
>
>  <?xml version="1.0" encoding="UTF-8" ?>
>  <jsp:root version="2.0"
>   xmlns:jsp="http://java.sun.com/JSP/Page"
>   xmlns:f="http://java.sun.com/jsf/core"
>   xmlns:h="http://java.sun.com/jsf/html"
>    xmlns:tr="http://myfaces.apache.org/trinidad">
>  <jsp:directive.page contentType="text/html; charset=utf-8"/>
>   <f:view>
>     <tr:document title="applying listbox values">
>       <tr:outputText value="clicking item in listbox doesn't update
>  outputText below:"/>
>       <tr:form>
>         <tr:panelFormLayout>
>           <tr:selectOneListbox label="item list:" value="#{bean.item}"
>  size="4"
>               valueChangeListener="#{bean.itemSelected}" autoSubmit="true">
>             <f:selectItems value="#{bean.items}"/>
>           </tr:selectOneListbox>
>         </tr:panelFormLayout>
>         <tr:outputText value="Selected: #{bean.item}"/>
>       </tr:form>
>     </tr:document>
>   </f:view>
>  </jsp:root>
>
>  and the following in the bean:
>
>  package nl.timeware.vrtsim.beans;
>  import java.util.*;
>  import javax.faces.event.ValueChangeEvent;
>  public class Bean
>  {
>   private Integer selectedItem = 1;
>
>   public Integer getItem()
>   {  System.out.println("getItem(): " + selectedItem);
>     return selectedItem;
>   }
>
>   public void setItem(Integer id)
>   {  System.out.println("setItem(" + id +")");
>     selectedItem = id;
>   }
>
>   public Map<String, Integer> getItems()
>   {  System.out.println("getItem(): " + selectedItem);
>     Map<String, Integer> itemMap = new TreeMap<String, Integer>();
>     itemMap.put("Item 1", 1); itemMap.put("Item 2", 2);
>  itemMap.put("Item 3", 3);
>     return itemMap;
>   }
>
>   public void itemSelected(ValueChangeEvent event)
>   {  System.out.println("itemSelected(" + event.getNewValue() +")");
>     selectedItem = (Integer)event.getNewValue();
>   }
>  }
>
>  If I click on one of the items, the following happens:
>
>  PhaseTracker.beforePhase(): RESTORE_VIEW 1
>  PhaseTracker.afterPhase(): RESTORE_VIEW 1
>  PhaseTracker.beforePhase(): RENDER_RESPONSE 6
>  getItem(): 1
>  getItem(): 1
>  getItem(): 1
>  PhaseTracker.afterPhase(): RENDER_RESPONSE 6
>   -- this is where I click the second item in the list --
>  PhaseTracker.beforePhase(): RESTORE_VIEW 1
>  PhaseTracker.afterPhase(): RESTORE_VIEW 1
>  PhaseTracker.beforePhase(): APPLY_REQUEST_VALUES 2
>  PhaseTracker.afterPhase(): APPLY_REQUEST_VALUES 2
>  PhaseTracker.beforePhase(): PROCESS_VALIDATIONS 3
>  getItem(): 1
>  getItem(): 1
>  itemSelected(2)
>  PhaseTracker.afterPhase(): PROCESS_VALIDATIONS 3
>  PhaseTracker.beforePhase(): UPDATE_MODEL_VALUES 4
>  setItem(2)
>  PhaseTracker.afterPhase(): UPDATE_MODEL_VALUES 4
>  PhaseTracker.beforePhase(): INVOKE_APPLICATION 5
>  PhaseTracker.afterPhase(): INVOKE_APPLICATION 5
>  PhaseTracker.beforePhase(): RENDER_RESPONSE 6
>  -- why isn't getItem() called here to render the outputText ? --  <<<<<
>  PhaseTracker.afterPhase(): RENDER_RESPONSE 6
>
>  What suprises me is that during the 2nd RENDER_RESPONSE phase never the
>  current value of the list is retrieved (Bean.getItem() is never called)
>  to render the outputText, with the result that it retains its now
>  obsolete value. getItem() is called in other phases, but that's of
>  course before its value was changed.
>
>  When I replace the <tr:selectOneListbox> by the <h:selectOneListbox>
>  things work as expected and the outputText is correctly updated.
>  Any suggestions what I should change or should I file a JIRA issue? I am
>  using trinidad with jsf-1.2_07-b03-FCS.
>
>  Thanks for any help, Paul.
>