-
Notifications
You must be signed in to change notification settings - Fork 853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some jsf wizards are completely messed up #7532
Comments
Please adjust and it might be actionable. For the only thing that I could place
Yes. We can discuss whether missing libraries should default to jakarta or javax namespace, but in any case we need to guess. So from my POV: Works as expected. |
Don't think it is a good idea to automatically generate code which is marked all red.
Create an entity class with "Entity classes from database" wizard According to me nobody has checked these wizards since their first release years ago and after the transitions from javax to jakarta, they generate wrong code. Here is my netbeans project |
I just generated a maven web application with the JakartaEE 10 selected. Then I did what you said and get a cleanly generated code. This was also done when the code templates for support of the jakarta namespace was added.
I strongly suggest, that you keep such accusations to yourself. You claim that this generated code: <h:commandLink action="#{badgeController.next}" is invalid. On what do you base that? Reading this: It explicitly gives this sample: <h:commandButton action="#{trader.buy}" value="buy"/> You can argue, that method references should always be generated with parantheses, but apparently they are not required. I validated that with a trivial JSF page on Glassfish 7.0.11. |
What remains for me is, that the JSF Controller seems to generate JSF |
Keep in mind that English is not my first language, I'm sorry if what I wrote may sound rude or impolite. I wanted to try the maven project way as suggested above to verify the results, but I'm completely stuck. Cannot select anything in that dialog window. Don't know if it is a Payara problem. I then installed latest Glassfish, I can add jsf framework, but I'm not familiar with maven project and finally I cannot deploy due to a persistence unit problem. In fact there is no @PersistenceContext(unitName = "myPU") annotation and I don't know how to tell the name of the Persistence unit. |
I finally found the @PersistenceUnit annotation, I was looking in the wrong class. In my first post I forgot another problem I saw. UPDATE |
For the code generation issues, this PR should help: #7539. A dev build is available from the checks page of the PR or directly: https://github.com/apache/netbeans/suites/25564462784/artifacts/1661001646. |
Assuming no news is good news, I'll merge the fix next week. |
Apache NetBeans version
Apache NetBeans 22
What happened
New web application selecting jakarta 10 EE web with jakarta.faces-4.0.4.jar.
"Entity classes from database" wizard is selected.
If Jakarta EE 10 API Library has already been added the imported packages are the correct ones: *jakarta.persistence. **, otherwise they are *javax.persistence. ** and lots of errors are reported.
"JSF pages from entity classes" wizard is selected.
Here are some lines extracted from generated controller class:
import jakarta.faces.bean.ManagedBean;
import jakarta.faces.bean.SessionScoped;
@ManagedBean(name = "badgeController")
@SessionScoped
Non existent packages and deprecated annotations are inserted
Controller code not compatible with generated jsf pages:
public String next() { getPagination().nextPage(); recreateModel(); return "List"; }
<h:commandLink action="#{badgeController.next}"
next is not a property, so its should be next()
In generated jsf pages most functions are called as they were properties so there are runtime errors.
Language / Project Type / NetBeans Component
No response
How to reproduce
Use the wizards and check produced code
Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows 11 pro
JDK
openjdk version "17.0.4.1"
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
No response
Are you willing to submit a pull request?
No
The text was updated successfully, but these errors were encountered: