If someone will have the same problem in the future, here is the solution: The content I put into value attribute is an object which holds binary data of a image. I want to display a pdf file using JSF and rich faces, using a4j tag library. Can anyone give me a quick how-to?. The a4j:mediaOutput> component implements one of the basic features specified in the framework. The component is a facility for generating images, video.
|Published (Last):||1 October 2015|
|PDF File Size:||19.30 Mb|
|ePub File Size:||2.86 Mb|
|Price:||Free* [*Free Regsitration Required]|
As You see from the example above, first it is necessary to specify the kind of media data You want to generate. This can be done with the help of “element” attribute, which possible values are imgobjectappletscriptlink or a.
The “cacheable” defines whether the response will be cached or not.
In our case we don’t need our image to be cached, cause we need it to be changed every time we refresh the page. The “mimeType” attribute defines the type of output content.
Problem with a4j mediaOutput to render pdf file (JSF forum at Coderanch)
It is used to define the corresponded type in the header of an HTTP response. The method accepts two parameters. The first one — with an java. OutputStream type — is a reference to the stream that should be used for output.
An output stream accepts output bytes and sends them to a recipient. The second parameter is a reference to the component’s “value” attribute and has java.
This parameter contains deserialized object with data specified in the “value” attribute. Now let’s create the MediaBean class and specify there a primitive random-number generator and paint method that will convert the generated numbers into an output stream and give a JPEG image as a result. The code for MediaBean class is going to look as following:. Now it is msdiaoutput to create a class that will keep transmissional data that will be used as input data for mediaoutpht content creation method.
The code for MediaData class is going to be as following:. A bean class transmitted into value should implement Serializable interface in order to be encoded to the URL of the resource. Hence, when using the component it’s possible to output your data of any type on a page with Ajax requests. This will launch the RichFaces Jira page – to complete your feedback please login if needed, and submit the Jira.
Component Identification Parameters Name Value component-type org.