Throwing an error when nesting forms #181

Closed
cocorossello opened this Issue Nov 14, 2015 · 5 comments

Projects

None yet

3 participants

@cocorossello

Nesting forms is illegal in both html or JSF. The problem is that the behaviour is unpredictable and is rather hard to see that an ajax error is produced by this mistake. I think it would be good if omnifaces could throw an error when nesting forms (or throw an error in development and log an error in production, or at least log an error).

Due to our inexperience with JSF we started with a form in the template and we are now migrating it but from time to time sometimes someone nests 2 forms and we realize a few days later...

@paulobing

I'm also facing this issue sometimes with our template! Let me know if you guys release a new version with this feature.

Thanks

@BalusC
Member
BalusC commented Nov 26, 2015

Reasonable.

@BalusC BalusC added a commit that closed this issue Jul 16, 2016
@BalusC BalusC Fix #181: add NestedFormsChecker to OmniViewHandler
(took the opportunity to parameterize Components#invoke())
c7909c1
@BalusC BalusC closed this in c7909c1 Jul 16, 2016
@BalusC
Member
BalusC commented Jul 16, 2016

I added one which automatically runs during development stage.

It's available in today's latest 2.5-SNAPSHOT.

@cocorossello

Sorry for the delay, couldn't test it. Application does not boot on tomee 7.0.1 since 2.5-SNAPSHOT (it does boot with 2.4).

This is a trace of an empty webapp only with omnifaces 2.5-SNAPSHOT jar:

Caused by: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
at org.omnifaces.ApplicationInitializer.checkCDIImplAvailable(ApplicationInitializer.java:194) ~[na:na]
at org.omnifaces.ApplicationInitializer.checkCDI11Available(ApplicationInitializer.java:108) ~[na:na]
at org.omnifaces.ApplicationInitializer.onStartup(ApplicationInitializer.java:69) ~[na:na]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) ~[catalina.jar:8.5.3]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) ~[catalina.jar:8.5.3]
... 10 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at org.omnifaces.ApplicationInitializer.checkCDIImplAvailable(ApplicationInitializer.java:191) ~[na:na]
... 14 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.apache.webbeans.container.OwbCDI.getBeanManager(OwbCDI.java:51) ~[openwebbeans-impl-1.6.3.jar:1.6.3]

I'll try to see what is wrong here, since minimum requirements should be met with tomee 7.0.1

@BalusC
Member
BalusC commented Aug 1, 2016

Might be related to #281. The showcase app deploys fine for me on both 7.0.1 Plus and Plume though.

How does the beans.xml of your test webapp look like? The showcase app has just an empty one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment