public AjaxResponse replaceElement(AjaxActionEvent event) {
// Create the new input field:
InputField field = new InputField("replaced", "Replaced", InputField.InputType.TEXT);
// Create an ajax action for replacing the old element:
ReplaceElementAction action = new ReplaceElementAction("toReplace", field);
// Create a concrete ajax response:
AjaxResponse response = new AjaxResponseImpl();
// Add the action:
response.addAction(action);