Search code examples
jsfjakarta-eenetbeansjsf-2

Managed bean annotation is stricken out (crossed by a line)


I have a problem when trying to use @ManagedBean, it appears like this : @ManagedBean,

Check the image below :

here is a photo of the code

enter image description here

Yesterday, I could create a project and use it, but today I cannot, I don't know what happened , maybe because I changed GlassFish 4 to 5 , and PostgreSQL 9.3 to 10?

EDIT: I tried to see my others project, and they are all stricken out in @ManagedBean.


Solution

  • The crossed line (aka "strikethrough") on a class, method, or annotation means that it has been deprecated by the author and you should no longer use it. If you mouse over the annotation, it should give you some sort of explanation as to why it was deprecated, and what you should use instead.

    In this case, the JSF @ManagedBean annotation was "strongly discouraged" in JSF 2.2, and officially deprecated in JSF 2.3 (hence the strikethrough in your IDE). Instead, you should use the @Named annotation which is provided by CDI and is a more standard way of creating a bean in Java EE.