This content has been marked as final.
Show 4 replies
-
1. Re: How to set HtmlActionParameter value dynamically?
leiras Jun 9, 2008 8:41 AM (in response to leiras)I change the static way to work with "bindind" instead "value", like this:
<a4j:actionparam name="xxx" binding="#{item.id}" assignTo="#{auditoria.idAuditoriaSelecionada}" />
and it keeps working with no problem. But the dynamic way is not working.HtmlActionParameter actionparam = new HtmlActionParameter(); actionparam.setValueBinding("vb", application.createValueBinding("#{item.id}")); actionparam.setAssignToBinding(application.createValueBinding("#{origem.selectedId}"));
The value assigned to "origem.selectedId" is always null.
Could someone help please? Thanks a lot. -
2. Re: How to set HtmlActionParameter value dynamically?
leiras Jun 9, 2008 9:32 AM (in response to leiras)I think the correct way is use the method "setValue" instead "setValueBinding", like the following code:
actionparam.setValue("#{item.cnpj}"); actionparam.setAssignToBinding(application.createValueBinding("#{origem.strTeste}"));
but the value assigned to "origem.strTeste" is always the string "item.cnpj" when actually should be the content of the property called "cnpj". How can I do that? -
3. Re: How to set HtmlActionParameter value dynamically?
mores Jul 14, 2008 11:54 AM (in response to leiras)Have you gotten this to work yet ?
I too am struggling with this problem. -
4. Re: How to set HtmlActionParameter value dynamically?
mores Jul 14, 2008 12:54 PM (in response to leiras)This seems to work for me:
org.ajax4jsf.component.html.HtmlAjaxCommandLink link = new org.ajax4jsf.component.html.HtmlAjaxCommandLink(); link.setId( "link" ); javax.faces.component.html.HtmlOutputText title = new javax.faces.component.html.HtmlOutputText(); title.setId( "title" ); title.setValue( "My Link" ); link.getChildren().add( title ); org.ajax4jsf.component.html.HtmlActionParameter ap = new org.ajax4jsf.component.html.HtmlActionParameter(); ap.setId( "param" ); ap.setName( "username" ); ap.setValue( "Alex" ); javax.faces.application.Application application = context.getApplication(); javax.el.ExpressionFactory ef = application.getExpressionFactory(); javax.el.ValueExpression ve = ef.createValueExpression( context.getELContext(), "#{userBean.name}", UserBean.class ); ap.setAssignToBinding( ve ); link.getChildren().add( ap ); link.addActionListener( ap );