0

Websphere 5 Java 6 Jsf 2.x Mojarra 2.3.2

I need to pass as method argument the primefaces "var" datatable attribute to a composite.

xhtml

 <p:dataTable id="dtPub" 
            var="pub" 
            widgetVar="pub"
            value="#{pubMB.pubList}">
 <p:column....>
 <p:commandLink onclick="PF('confirmationRev').show()" >
   ....
   ....
   <p:/datatable> 


    <services:genericConfirmDialog
       widgetvar="confirmationRev"
       actionbeanbotao1="#{pubMB.delete()}"
       varDatatable="pub"/>

Composite :

<composite:interface>
             <composite:attribute name="varDatatable" />
             <composite:attribute name="actionbeanbotao1" method-signature="java.lang.String action()" />

<p:commandButton id="confirm" value="#{cc.attrs.labelbotao1}"  
    action="#{cc.attrs.actionbeanbotao1(#{cc.attrs.varDatatable})}" />

action="#{cc.attrs.actionbeanbotao1(#{cc.attrs.varDatatable})}" Cannot add parameters to a MethodExpression pointing to cc.attrs

The idea is to pass as argument the primefaces datatable var to then bean delete #{pubMB.delete(xxxxxx)} I tested without composite and its working fine. its passing to bean method delete the var and deletng the record.

Al2x
  • 1,001
  • 5
  • 26
  • 37
  • What if you don't use a `p:commandButton` but a `h:commandButton` with `f:ajax`? and with a `h:dataTable` Does it work then? Sure it works if you have the code without a composite and outside the datatable? If really so, please post a fully working yet minimal example of that. I'm almost sure you have a different solution then – Kukeltje Jul 06 '18 at 18:49
  • And why this complex? Why not pass the 'row' or whatever to the server on the moment you cliock the related button, sort of when selecting? And then update the generic dialog? Feels like an overly complicated solution https://stackoverflow.com/questions/4994458/how-can-i-pass-selected-row-to-commandlink-inside-datatable-or-uirepeat?rq=1 – Kukeltje Jul 06 '18 at 18:58
  • I need to follow the template I posted on this topic. with composite. – Al2x Jul 06 '18 at 20:00
  • Why? Because an 'architect' ordered you to? And I nowhere stated you should not use a composite... just a different more common way of using components. This solution is very uncommon – Kukeltje Jul 06 '18 at 20:45

1 Answers1

0

action="#{cc.attrs.actionbeanbotao1(#{cc.attrs.varDatatable})}" />

did you try this way?

Ömer Faruk Kurt
  • 500
  • 3
  • 14
  • Yes. I tried before. this error is documented on my post. action="#{cc.attrs.actionbeanbotao1(#{cc.attrs.varDatatable})}" Cannot add parameters to a MethodExpression pointing to cc.attrs – Al2x Jul 07 '18 at 16:41
  • The actionbeanbotao1 is not (visibly) defined as a method in the composite and the varDatatable is OUTSIDE the datatable not-existent. So it cannot work... OP should tell the 'designer/architect' he/she is making a conceptual mistake – Kukeltje Jul 07 '18 at 18:16
  • I just ommited this tag in the post. updated as well but its no working either. – Al2x Jul 07 '18 at 19:24
  • Worst thing you can do... Purpously removing relevant code... and NO it won't work. the variable is not known outside the datatable... – Kukeltje Jul 07 '18 at 20:52