What DTD should I use in JSF 1.2/2.0/2.1 to validate my configuration XML?
Asked Answered
G

1

7

currently, I have following DTD:

<!DOCTYPE faces-config PUBLIC
 "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
 "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

And it does not validate the 1.2 tags, like:

managed-bean => managed-property

And I cannot find a newer version form sun: http://java.sun.com/dtd/

from some tutorials, I see people simply not using DTD for JSF 2 at all, should I try to find a DTD or is DTD deprecated for JSF 1.2+?

Many thanks for your suggestions.

Gather answered 26/5, 2011 at 12:31 Comment(0)
B
13

JSF 2.0 doesn't have a DTD. It's a XSD.

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0"
>
    <!-- Config here -->
</faces-config>

The same story applies to JSF 1.2.

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
    version="1.2"
>
    <!-- Config here -->
</faces-config>

If you were using a JSF 1.1 DTD on JSF 1.2/2.0, then those applications will run in JSF 1.1 mode. You really don't want to have that.

Boding answered 26/5, 2011 at 12:37 Comment(2)
Just replace 2_0 and 2.0 by 1_2 and 1.2. I added it to the answer.Boding
thank you, will mark it as answered after the cooling down 7 minutes.Gather

© 2022 - 2024 — McMap. All rights reserved.