a4j:mediaOutput component does just two things:
1) render HTML tag (OBJECT/IMG/APPLET/etc.) according to the defined component's attributes with the link to resource
2) deliver resource contents to the client when browser requests it.
Browser actually does the rest. So, for your case, you need to find out what settings (ClassID/Mime-Type) are required to embed Office documents. I suggest you to consult Office documentation/MSDN to find out some more information about this or wait for somebody from RF community to share experience.
Hello, I did not get any reply as far as this problem.
I think that it should be an interesting concern providing a general component that works well with any document extension.
I saw that using the type attribute instead of contentype something works better and pdf are properly rendered.
I'd like to know which is the difference between type and contentype as far as the a4j:mediaoutput component is concerned.
Problems still persist with office document such as excel, doc, docx and so on.
I'm running my application on windows and I saw that using the instruction
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
the documents are properly rendered in an other page by the correct applications (word for doc documents, power point for ppt and so on).
So my question is why does the mediaoutput not succeed in performing the same rendering ?
Is there a way to invoke the process exec as described above and make the result appear in the mediaoutput?
The rendering method of the mediaoutput component just takes data (that may be the file's bytes or the filename) and an output stream as inputs and I do not know how to use them in order to render the process and see the result.
An other approach might be invoking the process and showing the result in a iframe or div element but I have no experience of this and I'd like to know which approach is better and would be greatful if someone smight suggest me some hint.
It's not possible to execute arbitrary process from the browser due to security reasons. Also possibility of embedding Office documents should be supported by your browser environment (i.e. I usually switch embedding PDF files off and you can't use anything to show them in browser then). Again only IE browser support ActiveX objects, others will need plugins. If documents embedding is supported by the environment, then you just have to set proper attributes for a4j:mediaOutput (CLSID or contentType) to get the document shown. If not, then you can convert documents to Flash format and use it, but again, if no Flash player installed, no way to show the document.