[richfaces-issues] [JBoss JIRA] Created: (RF-7136) h:inputText doesn't reflect backing bean value on ajax rerendering

Denis Petrunin (JIRA) jira-events at lists.jboss.org
Wed May 13 15:04:47 EDT 2009


h:inputText doesn't reflect backing bean value on ajax rerendering
------------------------------------------------------------------

                 Key: RF-7136
                 URL: https://jira.jboss.org/jira/browse/RF-7136
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.3.0
         Environment: RichFaces 3.3.0GA
Mojarra JSF Implementation 1.2_12-b01-FCS
            Reporter: Denis Petrunin


1) open edit.jsf page (see below)
2) input "1" into "Id" field,  click "Edit" button
3) make a note that "Name" field contains "First", "Note" field contains "Note-1"
4) clear "Name" field, click "Save" button
5) make a not that the error message is shown: "fmEdit:itName: Validation Error: Value is required."
6) input "2" into "Id" field,  click "Edit" button
7) make a note that "Name" field contains "Second", "Note" field still contains "Note-1"

Expected result: "Note" field must contain "Note-2"

I think other UIInput, UIData are affected as well.

<<===== edit.jspx =====>>

<?xml version="1.0" encoding="UTF-8"?>
<!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:rich="http://richfaces.org/rich"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:s="http://jboss.com/products/seam/taglib">
<head>
</head>
<body>

<h:form id="fmItemSelector">
	<h:outputLabel value="Id" />
	<h:inputText value="#{bean.editingItemId}" />
	<a4j:commandButton value="Edit" reRender="fmEdit" />
</h:form>
<h:form id="fmEdit">
	<h:panelGrid columns="2">
		<h:outputLabel value="Name" />
		<h:inputText id="itName" value="#{bean.editingItem.name}" required="true" disabled="#{bean.editingItem == null}" />
		<h:outputLabel value="Note" />
		<h:inputText id="itNote" value="#{bean.editingItem.note}" required="true" disabled="#{bean.editingItem == null}" />
	</h:panelGrid>
	<a4j:commandButton value="Save" rendered="#{bean.editingItem != null}" action="#{bean.save}" reRender="fmItemSelector, fmEdit" />
</h:form>
<rich:messages />

</body>
</html>

<<===== Backing bean  =====>>

import java.util.Arrays;
import java.util.List;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name("bean")
@Scope(ScopeType.SESSION)
public class Test
{
    private static final List<Item> model = Arrays.asList(new Item(1, "First", "Note-1"), new Item(2, "Second", "Note-2"));

    private Integer editingItemId;

    public Item getEditingItem()
    {
        if (editingItemId == null)
            return null;
        for (Item item : model) {
            if (item.getId() == editingItemId)
                return item;
        }
        return null;
    }

    public void save()
    {
        editingItemId = null;
    }

    public Integer getEditingItemId()
    {
        return editingItemId;
    }

    public void setEditingItemId(Integer editingItemId)
    {
        this.editingItemId = editingItemId;
    }

    public static class Item
    {
        private int id;

        private String name;

        private String note;

        public Item(int id, String name, String note)
        {
            this.id = id;
            this.name = name;
            this.note = note;
        }

        public int getId()
        {
            return id;
        }

        public void setId(int id)
        {
            this.id = id;
        }

        public String getName()
        {
            return name;
        }

        public void setName(String name)
        {
            this.name = name;
        }

        public String getNote()
        {
            return note;
        }

        public void setNote(String note)
        {
            this.note = note;
        }
    }
}

-- 
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 richfaces-issues mailing list