Afficher message sur mediaOutput
bonjour tout le monde j'ai un problème je voudrais afficher un document dans ma page en utilisant mediaOutput :
class test1 qui contient méthode paintSTC
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
public void printSTC(OutputStream out, Object data ) throws DocumentException,IOException {
Document document = new Document();
document.addAuthor("Me");
document.addTitle("My iText Test");
document.open();
Chunk chunk = new Chunk("iText Test");
Font font = new Font(Font.COURIER);
font.setStyle(Font.UNDERLINE);
font.setStyle(Font.ITALIC);
chunk.setFont(font);
chunk.setBackground(Color.CYAN);
document.add(chunk);
Paragraph paragraph = new Paragraph();
paragraph.add("Hello World");
paragraph.setAlignment(Element.ALIGN_CENTER);
document.add(paragraph);
document.close();
System.out.println("Success!");
} |
appel a cette méthode dans le tag mediaOutput :
Code:
1 2 3 4 5
|
<a4j:mediaOutput id="bMRNPrintStc" type="application/pdf" styleClass="pdf"
element="object" cacheable="false" mimeType="application/pdf" session="true"
createContent="#{test1.printSTC}">
</a4j:mediaOutput> |
mais l'affichage est vide ne contient pas le message Hello World
merci d'avance