Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
986 views
in Technique[技术] by (71.8m points)

jsf 2 - libraries for JSF (Sun/Oracle Mojarra)

I am downloading Sun/Oracle Mojarra implementation of JSF from http://javaserverfaces.java.net/download.html

I downloaded the latest -2.1.9 binary. It comes with only one jar - javax.faces-2.1.9.jar. I had a sample project which I believe is using the older 2.0 version, which includes 2 jars - jsf-api.jar and jsf-impl.jar.

I replaced those 2 older jars with the single new jar. It seems like the sample project still works well.

My question:

  1. Is there anything else I need to do besides replacing those 2 jars???

  2. Any special reason this is this changed from 2 jars to 1?

Thanks a lot.

MORE:

I noticed versions in my faces-config.xml

<?xml version="1.0"?>
<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">
</faces-config>

I changed 2.0 and 2_0 to 2.1 and 2_1. The sample project still works. SHould I make these changes?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Is there anything else I need to do besides replacing those 2 jars?

No.


Any special reason this is this changed from 2 jars to 1?

Around the time of the release of 2.1.6, they've refactored the build system conform Java EE Maven rules. See also Mojarra issue 2028. This resulted in the two well known jsf-api.jar and jsf-impl.jar files being replaced by a single javax.faces.jar file.


I changed 2.0 and 2_0 to 2.1 and 2_1. The sample project still works. SHould I make these changes?

You can just do so. The only difference is that the faces-config 2.1 XSD definies two new elements as opposed to faces-config 2.0 XSD:

  • <facelet-cache-factory> to register a custom FaceletCache
  • <redirect-param> to specify request parameters for in a redirect navigation case.

If you don't need any of them, then it don't matter if you're using the 2.0 or 2.1 XSD. Mojarra 2.1 has internally no 2.0 fallback modus when using JSF 2.1 with a 2.0 XSD.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...