You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Jason Abreu <ja...@gmail.com> on 2021/12/05 18:45:31 UTC

JSF CDI code assist

I'm using NetBeans 12.5 with a new Gradle 7 web project and am having 
issues with code completion working within JSF EL (Jakarta JSF 3.0).  I 
could definitely use some assistance figuring this out.

Steps Taken:

1.  Created new Gradle Web project (declared dependency for jakarta ee 
9.1 api)
2.  Created a CDI Bean (using @Named and @SessionScoped annotations), 
"SampleBean" with a sample method, "(get|set)SampleString," returning a 
String.
3.  Defined the JSF servlet within web.xml
4.  Edit the JSF page (.xhtml) and added a JSF EL reference to my Sample 
Bean, #{sampleBean.sampleString}

The project built and packaged as a WAR successfully and deployed and 
executed in GlassFish 6.2.2 as expected.

However, when I use code completion (Ctl-Space) within the JSF EL I do 
not see my CDI bean as an option to select nor does code completion work 
to show me the methods of the CDI bean after I type the bean name.  Code 
completion works on all tags, even when using a framework such as 
PrimeFaces, just not with my custom CDI beans within JSF EL.

I have tried a work-around mentioned for a JSP issue by editing my 
Gradle build script to include the webapp source in the java sourceSet, 
but this does not resolve the issue.

Thank you,
Jason


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: JSF CDI code assist

Posted by Jason Abreu <ja...@gmail.com>.
I have narrowed down the breakage of the code completion for CDI beans.  
It occurs when using the jakarta ee 9 api, when the "javax" package name 
changed to the "jakarta" package name. Projects that use the "javax" API 
have working code completion in JSF/JSP EL.

Creating a project (gradle or ant) against Jakarta EE 8 (still using 
javax.* packages) has functioning code completion for CDI beans within 
JSF/JSP page expressions.
Creating a project (gradle or ant) against Jakarta EE 9 (using new 
jakarta.* packages) has broken code completion for CDI beans within 
JSF/JSP page expressions.

I think this may be something to file a bug report for.

Thanks for all the feeback!

Jason

On 12/6/21 3:00 PM, Jason Abreu wrote:
> I have also created a sample web project using Ant and observe the 
> same behavior.  With the new Jakarta EE, the code assist in JSP EL 
> ("${...}") and JSF EL ("#{...}") does not show any of my CDI beans, 
> only a "No suggestions" message.  This occurs with both Ant and Gradle 
> projects.  The code completion DOES work when using an older Java EE 
> API project.
>
> Has anybody else observed this behavior?  While it's not a 
> deal-breaker, because it does not affect building, it does add much 
> time to development because I have to open any referenced classes and 
> flip back and forth between them all to ensure I get the methods name 
> correct.  This is a very big annoyance that I'd like to figure out a 
> remedy to quickly.
>
> Thanks,
>
> Jason
>
> On 12/5/21 1:45 PM, Jason Abreu wrote:
>> I'm using NetBeans 12.5 with a new Gradle 7 web project and am having 
>> issues with code completion working within JSF EL (Jakarta JSF 3.0).  
>> I could definitely use some assistance figuring this out.
>>
>> Steps Taken:
>>
>> 1.  Created new Gradle Web project (declared dependency for jakarta 
>> ee 9.1 api)
>> 2.  Created a CDI Bean (using @Named and @SessionScoped annotations), 
>> "SampleBean" with a sample method, "(get|set)SampleString," returning 
>> a String.
>> 3.  Defined the JSF servlet within web.xml
>> 4.  Edit the JSF page (.xhtml) and added a JSF EL reference to my 
>> Sample Bean, #{sampleBean.sampleString}
>>
>> The project built and packaged as a WAR successfully and deployed and 
>> executed in GlassFish 6.2.2 as expected.
>>
>> However, when I use code completion (Ctl-Space) within the JSF EL I 
>> do not see my CDI bean as an option to select nor does code 
>> completion work to show me the methods of the CDI bean after I type 
>> the bean name.  Code completion works on all tags, even when using a 
>> framework such as PrimeFaces, just not with my custom CDI beans 
>> within JSF EL.
>>
>> I have tried a work-around mentioned for a JSP issue by editing my 
>> Gradle build script to include the webapp source in the java 
>> sourceSet, but this does not resolve the issue.
>>
>> Thank you,
>> Jason
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: JSF CDI code assist

Posted by Eric Bresie <eb...@gmail.com>.
Your not using the version with the new Jakarta namespace instead of the javaee namespace are you?

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Will Hartung <wi...@gmail.com>
Sent: Thursday, December 9, 2021 3:47:38 PM
To: NetBeans Mailing List <us...@netbeans.apache.org>
Subject: Re: JSF CDI code assist



On Mon, Dec 6, 2021 at 12:00 PM Jason Abreu <ja...@gmail.com>> wrote:
I have also created a sample web project using Ant and observe the same
behavior.  With the new Jakarta EE, the code assist in JSP EL ("${...}")
and JSF EL ("#{...}") does not show any of my CDI beans, only a "No
suggestions" message.  This occurs with both Ant and Gradle projects.
The code completion DOES work when using an older Java EE API project.

So if you open a legacy project, the behavior works? But with a new project, it does not?

Have you tried "cloning" the working project to see if it works today? Can you replicate your "SampleBean" example based on the older project? How do the new project and the old projects differ?

And, honestly, it is a deal breaker. Otherwise you may as well be using a "dumb" editor. Auto complete is part and parcel to the modern IDE experience.



Re: JSF CDI code assist

Posted by Will Hartung <wi...@gmail.com>.
On Mon, Dec 6, 2021 at 12:00 PM Jason Abreu <ja...@gmail.com> wrote:

> I have also created a sample web project using Ant and observe the same
> behavior.  With the new Jakarta EE, the code assist in JSP EL ("${...}")
> and JSF EL ("#{...}") does not show any of my CDI beans, only a "No
> suggestions" message.  This occurs with both Ant and Gradle projects.
> The code completion DOES work when using an older Java EE API project.
>

So if you open a legacy project, the behavior works? But with a new
project, it does not?

Have you tried "cloning" the working project to see if it works today? Can
you replicate your "SampleBean" example based on the older project? How do
the new project and the old projects differ?

And, honestly, it is a deal breaker. Otherwise you may as well be using a
"dumb" editor. Auto complete is part and parcel to the modern IDE
experience.

Re: JSF CDI code assist

Posted by Jason Abreu <ja...@gmail.com>.
I have also created a sample web project using Ant and observe the same 
behavior.  With the new Jakarta EE, the code assist in JSP EL ("${...}") 
and JSF EL ("#{...}") does not show any of my CDI beans, only a "No 
suggestions" message.  This occurs with both Ant and Gradle projects.  
The code completion DOES work when using an older Java EE API project.

Has anybody else observed this behavior?  While it's not a deal-breaker, 
because it does not affect building, it does add much time to 
development because I have to open any referenced classes and flip back 
and forth between them all to ensure I get the methods name correct.  
This is a very big annoyance that I'd like to figure out a remedy to 
quickly.

Thanks,

Jason

On 12/5/21 1:45 PM, Jason Abreu wrote:
> I'm using NetBeans 12.5 with a new Gradle 7 web project and am having 
> issues with code completion working within JSF EL (Jakarta JSF 3.0).  
> I could definitely use some assistance figuring this out.
>
> Steps Taken:
>
> 1.  Created new Gradle Web project (declared dependency for jakarta ee 
> 9.1 api)
> 2.  Created a CDI Bean (using @Named and @SessionScoped annotations), 
> "SampleBean" with a sample method, "(get|set)SampleString," returning 
> a String.
> 3.  Defined the JSF servlet within web.xml
> 4.  Edit the JSF page (.xhtml) and added a JSF EL reference to my 
> Sample Bean, #{sampleBean.sampleString}
>
> The project built and packaged as a WAR successfully and deployed and 
> executed in GlassFish 6.2.2 as expected.
>
> However, when I use code completion (Ctl-Space) within the JSF EL I do 
> not see my CDI bean as an option to select nor does code completion 
> work to show me the methods of the CDI bean after I type the bean 
> name.  Code completion works on all tags, even when using a framework 
> such as PrimeFaces, just not with my custom CDI beans within JSF EL.
>
> I have tried a work-around mentioned for a JSP issue by editing my 
> Gradle build script to include the webapp source in the java 
> sourceSet, but this does not resolve the issue.
>
> Thank you,
> Jason
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists