I think the answer BalusC gave is the best possible answer. It shows one of the many small reasons why JSF 2.0 is such a big improvement over 1.x.
If you're on 1.x, you could try an EL function that puts the ID of the component into the request scope under some name your backing bean method can pick up.
E.g.
<h:inputText id="foo" size="#{my:getWithID(configBean.size, 'foo')}" />
The EL method's implementation could look something like this:
public static Object getWithID(String valueTarget, id) {
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
context.getExternalContext().getRequestMap().put("callerID", id);
ValueExpression valueExpression = context.getApplication()
.getExpressionFactory()
.createValueExpression(elContext, "#{"+valueTarget+"}", Object.class);
return valueExpression.getValue(elContext);
}
In this case, whenever the getSize() method of the config bean is called, the ID of the calling component would be available via "callerID" in the request scope. To make it a little neater you should maybe add a finally block to remove the variable from the scope after the call has been made. (note that I didn't try the above code, but it hopefully demonstrates the idea)
Again, this would be a last resort when you're on JSF 1.x. The cleanest solution is using JSF 2.0 and the method BalusC describes.
[jsf-2.0]
, so he's using JSF 2.0 :) – Elisabeth