]
Milo van der Zee commented on RF-11803:
---------------------------------------
I'm talking about RF3.2 with MyFaces 1.2, pre previous code. Could be that it does
indeed function like the specs say but why does the jsFunction fix the problem? And why
does a second time render also change the output? Is 'render' something like a
'one level at a time' thing?
I changed all a4j: code to the h: and f: tags. It did not change anything. So I agree with
you that it seems to be something related to the JSF 2.1 implementations.
Should I file a bug for MyFaces (and Mojarra)?
Thank you very much,
Milo
render of 'c:' and 'fn:' is one click behind
--------------------------------------------
Key: RF-11803
URL:
https://issues.jboss.org/browse/RF-11803
Project: RichFaces
Issue Type: Bug
Security Level: Public(Everyone can see)
Environment: MyFaces 2.1.5, Tomcat 7.0.22, 4.1.0-20111204 from showcase
Reporter: Milo van der Zee
Assignee: Lukáš Fryč
Priority: Minor
Labels: render
'c:' and 'fn:' is rendered differently from previous versions.
When clicking the inc and dec buttons in the example you can see that the field contents
are updates each click but the number of fields is not (comma at the end when pressing
'dec'. Pressing 'render' then fixes the output.
When using a function to render it works fine. Even though the function does not do
much.
MAG,
Milo
{code:title="testje4.xhtml"}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<h:head>
</h:head>
<h:body>
<h:form>
<a4j:jsFunction name="render" render="panel,counter"
bypassUpdates="true" immediate="true" execute="@none"/>
<a4j:outputPanel id="counter">
Counter: #{testBean.counter}<br/>
</a4j:outputPanel>
<hr/>
<a4j:outputPanel id="panel">
<c:forEach id="fieldsDefinitions"
items="#{testBean.fieldsList}" var="field"
varStatus="status">
<c:set var="fields"
value="#{fields}#{field}#{status.last?'':','}"/>
</c:forEach>
<c:set var="fieldsArray" value="#{fn:split(fields,
',')}"/>
<a4j:repeat id="repeat" value="#{fieldsArray}"
var="field" rowKeyVar="status">
#{status+1}: '#{field}', '#{fields}'<br/>
</a4j:repeat>
</a4j:outputPanel>
<hr/>
Direct render:
<a4j:commandButton value="dec"
actionListener="#{testBean.decCounter()}" render="counter,
panel"/>
<a4j:commandButton value="inc"
actionListener="#{testBean.incCounter()}" render="counter,
panel"/>
<br/>
With function to render:
<a4j:commandButton value="dec"
actionListener="#{testBean.decCounter()}" oncomplete="render();"/>
<a4j:commandButton value="inc"
actionListener="#{testBean.incCounter()}" oncomplete="render();"/>
<br/>
Manual render:
<a4j:commandButton value="render" render="counter, panel"/>
</h:form>
</h:body>
</html>
{code}
{code:title="testBean.java"}
package com.test;
import java.util.Arrays;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class TestBean {
private int counter = 5;
public String getFieldsString() {
StringBuilder builder = new StringBuilder();
boolean firstField = true;
for (int i = 0; i < counter; i++) {
if (!firstField) builder.append(',');
firstField = false;
char[] fill = new char[i + 1];
Arrays.fill(fill, Character.forDigit(counter, 10));
String fieldName = new String(fill);
builder.append(fieldName);
}
return builder.toString();
}
public List<String> getFieldsList() {
String string = getFieldsString();
List<String> list = Arrays.asList(string.split(","));
return list;
}
public void decCounter() {
counter--;
if (counter < 1) counter = 1;
}
public void incCounter() {
counter++;
if (counter > 9) counter = 9;
}
public int getCounter() {
return counter;
}
public void setCounter(int counter) {
this.counter = counter;
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: