You could do so by binding the component to the bean:
<p:inputText binding="#{bean.input}" ... />
with
private InputText input; // +getter+setter
@PostConstruct
public void init() {
input = new InputText();
input.setMaxlength(15);
input.setStyle("background: pink;");
}
// ...
This is however not the recommended approach. You should rather bind the individual attributes to a bean property instead.
<p:inputText ... maxlength="#{bean.maxlength}" style="#{bean.style}" />
with
private Integer maxlength;
private String style;
@PostConstruct
public void init() {
maxlength = 15;
style = "background: pink;";
}
// ...
Even more, if your app is well designed, then you should already have such a bean object for this (why/how else would you like to be able to specify it during runtime?). Make it a property of the managed bean instead so that you can do something like:
<p:inputText ... maxlength="#{bean.attributes.maxlength}" style="#{bean.attributes.style}" />