Re: Add Pretty-Link dynamically

Splash Forums PrettyFaces Users Add Pretty-Link dynamically Re: Add Pretty-Link dynamically

#20419

atyauristen
Participant

why to ask if you know the answer? so here’s what I did:

UIComponent commenterLink = (Link)context.getApplication().createComponent(Link.COMPONENT_TYPE);

commenterLink.getAttributes().put(“mappingId”, “otherUserHomeTest”);

commenterLink.getAttributes().put(“styleClass”, COMMENTER_STYLECLASS);

HtmlOutputText userName = new HtmlOutputText();

userName.setValue(activa.getDisplayName());

UIParameter id = new UIParameter();

id.setValue(activa.getId());

commenterLink.getChildren().add(id);

commenterLink.getChildren().add(userName);

return commenterLink;

First I set the name of the UIParam as well, then after some time I realised that this is the one that causes com.ocpsoft.pretty.PrettyException: Invalid number of parameters supplied for pattern exception to be thrown. Now I see the difference between setting it or not in the documentation but I’m not sure that the text of the exception is enough to realise that :S So it would be nice to have a more precise exception if possible.

cheers,

balázs