[webbeans-issues] [JBoss JIRA] Commented: (WBRI-258) The conversation needs to be restored in the restore view phase in JSF 2

Dan Allen (JIRA) jira-events at lists.jboss.org
Wed May 6 14:30:46 EDT 2009


    [ https://jira.jboss.org/jira/browse/WBRI-258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12466111#action_12466111 ] 

Dan Allen commented on WBRI-258:
--------------------------------

Here is an example that demonstrates the problem:

DataList.java

public
@Named
@ConversationScoped
class DataList implements Serializable {

	private List<Data> data;
	private DataModel dataModel;

	@PostConstruct
	public void onCreate() {
		data = new ArrayList<Data>();
		data.add(new Data("one"));
		data.add(new Data("two"));
	}

	public List<Data> getData() {
		return data;
	}

	public DataModel getDataModel() {
		if (dataModel == null) {
			dataModel = new ListDataModel(data);
		}

		return dataModel;
	}

	public void act() {
		System.out.println(dataModel.getRowData());
	}
}

Data.java

public class Data {

	private String value;

	public Data() {
	}

	public Data(String value) {
		this.value = value;
	}

	public String getValue() {
		return value;
	}

	@Override
	public String toString() {
		return "Data" + hashCode() + "[ value = " + value + " ]";
	}
}

dataList.xhtml

      <h:form>
         <h:dataTable var="_data" value="#{dataList.dataModel}">
            <h:column>
               <f:facet name="header">Value</f:facet>
               <h:commandLink action="#{dataList.act}" value="#{_data.value}"/>
            </h:column>
         </h:dataTable>
      </h:form>

> The conversation needs to be restored in the restore view phase in JSF 2
> ------------------------------------------------------------------------
>
>                 Key: WBRI-258
>                 URL: https://jira.jboss.org/jira/browse/WBRI-258
>             Project: Web Beans
>          Issue Type: Bug
>    Affects Versions: 1.0.0.PREVIEW1
>            Reporter: Dan Allen
>             Fix For: 1.0.0.PREVIEW2
>
>
> JSF 2 walks the tree in the RestoreView phase, whereas JSF 1 does not. The timing causes a problem if you have a value expression bound to a conversation-scoped bean. The solution is to use a ComponentEventListener to restore the conversation rather than a phase listener. The listener should observe the PostRestoreStateEvent on UIViewRoot. Component listeners can be registered programmatically. WebBeans should detect which version of JSF is in use and act accordingly.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the weld-issues mailing list