0
votes

Having a basic JSF project with ADF which needs to delete a row from a table (every row is an Album) with a Delete button which is next to the requested row (each row has one).
Using JDeveloper trying with ADF (tried this solution too with just simple JSF:(How can I pass selected row to commandLink inside dataTable?) However, it seems to me that setPropertyListener and setPropertyActionListener are not invoking (put some dummy comments in the setCommon() function, not seen, also the beautiful comment from del_action() not showing). Also tried with @SessionScoped bean.
Main question: what went wrong that even the value passing is not working?
Any ideas would be highly appreciated (and sorry for the lack of syntax highlight, still a newbie, have not figured it out yet) :)

The JSF part:

<af:column sortable="false" headerText=" " align="start" id="c4"> 
 <h:commandButton value="Delete" id="del" action="#{backing_main.del_action}">
  <af:setPropertyListener to="#{backing_main.common}" from="#{row.albumName}" type="action" />
 </h:commandButton>
</af:column> 

Backing Bean:


   @ManagedBean(name="backing_main")
   @ViewScoped

   ...

    private String common; 
    public void setCommon(String common){
        System.out.print("!!!SET!!!!!");
        this.common = common;
    }

    public String getCommon(){
        return this.common;
    }

    public void del_action() {
        System.out.print("!!!!!!!!!!!!!!!!Delete1");     
    }

    public static class Album{

            String artist;
            String albumName;
            //constructor, setter, all the expected stuff
    }



1
The function del_action() need to return a string! - Amr Gawish

1 Answers

0
votes

You better use ADF components to get expected result: af:commandButton, instead h:commmandButton.

And if you ain't using taskflow to delete row, then you better switch to actionListener, instead of action.