This content has been marked as final.
Show 4 replies
-
1. Re: specify content type for XHMTL
sjmenden Aug 24, 2007 12:17 PM (in response to nemya)use the following in the page you want to be excel:
<f:view contentType="....."> </f:view}
where ..... is the excel mime type -
2. Re: specify content type for XHMTL
nemya Aug 24, 2007 12:29 PM (in response to nemya)I've already tryied that but it didn't work. I tried:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"> <head> <title>Page XHTML</title> <meta http-equiv="Content-Type" content="application/vnd.ms-excel; charset=iso-8859-1" /> </head> <body> <f:view contentType="application/vnd.ms-excel"> <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> </table> </f:view> </body> </html>
And I got this error message:java.lang.IllegalArgumentException: ContentTypeList does not contain a supported content type: application/vnd.ms-excel at org.apache.myfaces.renderkit.html.HtmlRendererUtils.selectContentType(HtmlRendererUtils.java:964) ...
-
3. Re: specify content type for XHMTL
sjmenden Aug 24, 2007 1:49 PM (in response to nemya)The myfaces HtmlRendererUtils doesn't look like it takes into account any other content types except text/html and application/xhtml+xml. JSF 1.2 RI on the other hand correctly handles it. So you can move to Seam 2.0 and JBoss 4.2, or you can just upgrade your existing project/JBoss to use JSF 1.2 RI, see the documentation. After that use the following:
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.ajax4jsf.org/rich"> <ui:composition> <f:view contentType="application/vnd.ms-excel"> <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> </table> </f:view> </ui:composition> </html>
-
4. Re: specify content type for XHMTL
nemya Oct 5, 2007 11:26 AM (in response to nemya)Hi
finally I migtrated to Seam 2.0.0.CR1 but your exemple still doesnt work!
Help