Meaningless Drivel is fun!*
The moose likes JSF and the fly likes different headers JSF 1.1 and JSF 2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "different headers JSF 1.1 and JSF 2.0" Watch "different headers JSF 1.1 and JSF 2.0" New topic
Author

different headers JSF 1.1 and JSF 2.0

Christin Vogt
Greenhorn

Joined: Nov 16, 2010
Posts: 1
hello together,

i work with jsf since 4 weeks. i started with JSF 1.1 and now i want to migrate my project to JSF 2.0.
i know that i have to change the header

header JSF 2.o:
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

header JSF 1.1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp_ID">

can someone explain me the different headers? i want to understand why i have to change them.

thank you!

greetz from germany
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
Welcome to JavaRanch

The main reason is that you move to using a new Java Servlet Specification. Old was 2.3 and the new is 2.5.

More background info for example from here
http://en.wikipedia.org/wiki/Java_Servlet

And you can naturally find the specifications from Oracle web site.

EDIT: Oh, and if you were wondering why the old was defined with dtd and the new one with xsd please read these
http://en.wikipedia.org/wiki/Document_Type_Definition
http://en.wikipedia.org/wiki/XML_Schema_%28W3C%29
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

It isn't a header, it's a schema reference. The schema reference points to a schema definition so that XML processors can automatically validate the XML.

The big difference here is that you're moving from a DTD to an XML schema (sometimes known as "xsd"). DTD's are the older of the 2 schema definition types and they are more limited, so newer specs use xsd's instead.

Whether you use a DTD or a schema, you do need to use the version that matches the XML content you're defining. Otherwise the XML parser will completely reject your XML without passing it on to the code that actually employs the XML.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: different headers JSF 1.1 and JSF 2.0