0

I would like to bind a method to my com.icesoft.faces.component.inputfile.InputFile object to get it behave as if was defined so:

<ice:inputFile id="inputFileComponent" actionListener="#{mainWindowManager.uploadActionListener}"

I create the InputFile instance but see several methods and none of them works.. :-(

com.icesoft.faces.component.inputfile.InputFile inputFile = new InputFile();

inputFile.addActionListener(..);
inputFile.setActionListener(..);
inputFile.setActionExpression(..);
inputFile.setAction(..);

Which method is for the binding described in the XML above..?

jabal
  • 11,987
  • 12
  • 51
  • 99

2 Answers2

0

The method triggered when selecting the file on disk should have this signature :

public void uploadActionListener(ActionEvent e){}

However, there is an additional parameter for ice:inputFile named "autoUpload". When set to true, the file submit should be performed immediately when file is selected on disk (if that is what you want to do).

Here is what it looks like in one of my project :

<ice:inputFile autoUpload="true" actionListener="#{myBean.myMethod}" submitOnUpload="postUpload" immediate="true" />

When the user select the file, the action is triggered immediately and form is submitted. Hope it helps.

Wis
  • 705
  • 1
  • 11
  • 34
  • That was not the thing I asked. I asked about the binding method, not the bind one. Please read questions carefully before answering. – jabal Dec 12 '11 at 16:06
  • True, I did miss the "as if it behave like". Have a look at http://stackoverflow.com/questions/4532955/what-is-the-advantages-of-using-binding-attribute-in-jsf it is on an inputText but should be pretty similar. – Wis Dec 13 '11 at 07:26
0

The winner is setActionListener(..) but the thing that I missed was setting an ID for the component, this caused all the mess.

jabal
  • 11,987
  • 12
  • 51
  • 99