a4j:mediaOutput méthod pain not found
bonjour,
j'essaie d'afficher un document dans ma page en utilisant mediaOutput :
en se basant sur cet exemple ceci
class bean qui contient methode paint
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| public class Bean {
public void paint(OutputStream out, Object data) throws IOException {
if (data instanceof String) {
InputStream file = FacesContext.getCurrentInstance()
.getExternalContext().getResourceAsStream((String) data);
int size = file.available();
byte[] pdf = new byte[size];
file.read(pdf);
file.close();
out.write(pdf);
}
}
} |
appel a cette méthode dans le tag mediaOutput :
Code:
1 2 3
| <a4j:mediaOutput element="object" cacheable="false" session="true"
value="rc044-010d-richfaces_3.pdf" createContent="#{bean.paint}"
type="application/pdf">something</a4j:mediaOutput> |
j'ai eu cette exception: property "paint" not found.