Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF, override HTTP headers

I strongly need to override JSF 2.0 Content-Type header. Default it is

Content-Type:application/xhtml+xml; charset=UTF-8

But I need

Content-Type:text/html; charset=UTF-8

Thanks.

like image 309
chardex Avatar asked Sep 27 '10 12:09

chardex


2 Answers

Use the right doctype.

<!DOCTYPE html>

Nothing more. Also don't put <?xml?> declaration at top. Here's a minimum template:

<!DOCTYPE html>
<html 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Insert your title</title>
    </h:head>
    <h:body>
        <h1>Hello World</h1>
    </h:body>
</html>

It's the HTML5 doctype. It's fully compatible with XHTML 1.x markup and adds more advantages.

like image 177
BalusC Avatar answered Sep 19 '22 17:09

BalusC


How about

<f:view contentType="text/html" />
like image 34
Vivien Barousse Avatar answered Sep 18 '22 17:09

Vivien Barousse