Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea can not resolve symbol f:viewAction [duplicate]

I have migrated my application from JSF 1.2 to 2.2.

It used XML namespaces on java.sun.com domain like xmlns:f="http://java.sun.com/jsf/core". However, Oracle's Java EE 7 tutorial is using XML namespaces on xmlns.jcp.org domain like xmlns:f="http://xmlns.jcp.org/jsf/core".

Which one is recommended and why was this changed?

like image 549
Valsaraj Viswanathan Avatar asked Nov 18 '22 00:11

Valsaraj Viswanathan


1 Answers

Which one is recommended?

Go ahead with XML namespaces on xmlns.jcp.org domain. This was newly introduced since Java EE 7 in 2013 (which covers a.o. JSF 2.2, Servlet 3.1, CDI 1.1, etc). Do note that this not only affects Facelets files, but also XML configuration files such as faces-config.xml, web.xml, beans.xml, etc.

The old XML namespaces on java.sun.com are still there for backwards compatibility, but the support will eventually disappear in a future Java EE version. You should migrate your code base as soon as you can. It should be a trivial task using "find and replace in all files" facility offered by the average IDE.

Only older Mojarra 2.2.0 / 2.2.1 versions have had bugs related to the XML namespace changes, but those should not manifest in newer versions. See also a.o.

  • Using new xmlns.jcp.org namespace on composites causes java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent
  • f:viewParam doesn't pass required parameter when new xmlns.jcp.org namespace is used
  • The metadata component needs to be nested within a f:metadata tag. Suggestion: enclose the necessary components within <f:metadata>

and why was this changed?

Because Java is not from Sun anymore since 2010. Note that they were smart to not make it java.oracle.com or something tight coupled to the currently owning company. It's now nicely and independently tied to the JCP (Java Community Process), the one really responsible for managing the Java (EE) specifications.

like image 181
BalusC Avatar answered Nov 23 '22 22:11

BalusC