• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically created component id changed during render response phase

Mark Rausch
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am using myfaces 1.1.1

I have a UIInput bound to a backing bean as follows:

<h:inputText binding="#{MyBean.input}"

In MyBean I have the following:

public UIComponent getInput()
if (null == input)
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
input = (UIInput) app.createComponent UIInput.COMPONENT_TYPE);

return input;

public void setInput(UIComponent input)
this.input = (UIInput)input;

During the render repsonse phase, the component id which was specified after creation using component.setId("someid") is replaced with a new id which looks something like "_id1". This was determined by implementing MyBean as a phaseListener and visually inspecting the UIViewRoot in beforePhase and afterPhase. Because the id is replaced any dynamically created Messages that may be bound to the input via the Message for attribute are now broken.

I am aware of the restrictions on setId() and am adhering to them
Must not be a zero-length String
First character must be a letter or an underscore ('_').
Subsequent characters must be a letter, a digit, an underscore ('_'), or a dash ('-').
The specified identifier must be unique

Any suggestions would be greatly appreciated.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic