Ajax render attribute don't work in a h:dataTable in JSF2

Posted by u2ix on Stack Overflow See other posts from Stack Overflow or by u2ix
Published on 2010-03-11T12:14:02Z Indexed on 2010/03/27 9:53 UTC
Read the original article Hit count: 597

Filed under:
|
|
|
|

Hello everybody,

I have some problem's with a simple application in JSF 2.0.

I try to build a ToDo List with ajax support. I have some todo strings which I display using a datatable. Inside this datatable I have a commandLink to delete a task. The problem is now that the datatable don't get re-rendered.

    <h:dataTable id="todoList" value="#{todoController.todos}" var="todo">
        <h:column>
                <h:commandLink value="X" action="#{todoController.removeTodo(todo)}">
                    <f:ajax execute="@this" render="todoList" />
                </h:commandLink>
        </h:column>
        <h:column>
            <h:outputText value="#{todo}"/>
        </h:column>
    </h:dataTable>

Thanks for your help.

Edit (TodoController):

@ManagedBean
@SessionScoped
public class TodoController {

private String todoStr;
private ArrayList<String> todos;

public TodoController() {
    todoStr="";
    todos = new ArrayList<String>();
}

public void addTodo() {
    todos.add(todoStr);
}

public void removeTodo(String deleteTodo) {
    todos.remove(deleteTodo);
}

/* getter / setter */
}

© Stack Overflow or respective owner

Related posts about java

Related posts about jsf2