Adding <f:attribut> to dynamic created componten

Hello,

I want to add an attribut-Tag to a dynamic created component.

What I need (when it is build static) is:

<h:inputText value="#{Ctrl.email}" id="email" >

<f:attribute name="Msg" value="Enter Email" />

</h:inputText>

what I tried was:

javax.faces.webapp.AttributeTag myAttributeTag =new AttributeTag();

myAttributeTag.setName("Msg");

myAttributeTag.setValue("Enter Email");

HtmlInputText edit_email =new HtmlInputText();

edit_email.setId("email");

edit_email.getChildren().add(myAttributeTag);

When I try to open the page I get an:

javax.servlet.ServletException: javax.servlet.jsp.JspException:javax.faces.el.EvaluationException: Error getting property 'x' from bean of type com.mybean

java.lang.ClassCastException

Has anyone an idea how I can add this attribute to my HtmlInputText ?

Greets and thanks

PS.: <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> ;-)

[1282 byte] By [Reddingoa] at [2007-11-27 5:47:31]
# 1

Set the attribute on the Map you get from getAttributes(), like this:

HtmlInputText edit_email = new HtmlInputText();

edit_email.setId("email");

edit_email.getChildren().add(myAttributeTag);

edit_email.getAttributes().put( "Msg", "Enter Email" );

BrantKnudsona at 2007-7-12 15:32:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Nice one :-D That works(ofc without the 'edit_email.getChildren().add(myAttributeTag);' )Thanks for your help
Reddingoa at 2007-7-12 15:32:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...