简体   繁体   中英

mojjara JSF 2.0 vs myfaces behaving differently

I am working on web application upgrade which involves below two upgrades

JSF 1.0 -> 2.x , Webspehere 7.0 -> 8.5

After upgrade if I switch to myfaces libs provided in WAS8.5 plugins, certain elements in UI tend to break. If I keep the implementaion to mojjara JSF2.0 libs, it seems to work fine.

One of the errors I am getting when I use myFaces 2.0 is

java.lang.IllegalArgumentException: Component javax.faces.component.UIInput is no javax.faces.component.html.HtmlInputText

This happened because <inputText> which is of type javax.faces.component.html.HtmlInputText tag had a binding to a model which returned new UIInput(); in getter method of model . (I know this is a bad code. But it's existing and was written to initialize text field with default values)

I can understand why this should not work. Because HtmlInputText is a subClass of UIInput . And when we try to bind object of Parent class where Child class is expected, this error is thrown. This is similar to when we try to cast a Parent Object to Child reference

Now if this is the case, then my question is how same code works with Mojjara JSF implementation. If I switch to Mojjara, I don't face this issue, which is surprising. Because I expected this issue with this also, since code violates general Parent Child Class rules.

Check this page - JavaServer Faces migration - it describes some migration details. In particular, if you use JWL:

You must update widget library to version 3.1.6 or higher to enable compatibility with the changes in the JSF 2.0 implementation. Obtain a compatible version of JWL by upgrading IBM® Rational® Application Developer for WebSphere to 7.5.5.2 or later or installing IBM Rational Application Developer for WebSphere V8.0 and later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM