How to let custom component participate in form submission

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to let custom component participate in form submission

abangkis
Hai guys, still working on my custom component.

How do we let our custom component participate in form submission.
Apparently there is no onPrepare hook for tapestry custom component.
http://tapestry.apache.org/component-rendering.html.

I'm reading
http://jumpstart.doublenegative.com.au/jumpstart/examples/component/subformvalidation1
example. But still haven't grasp the general gist
about ProcessSubmission/ComponentAction. Calling the prepare method from
process submission doesn't seems to work. Rendering the component is fine,
but when submitting the page I receive the error and stack trace bellow.

Any advice? Thanks.

Here's my custom component setup & prepare method:

    private static final ProcessSubmission PROCESS_SUBMISSION = new
ProcessSubmission();

    // Tapestry calls afterRender() AFTER it renders any components I
contain (ie. Loop).
    final void afterRender() {

        // If we are inside a form, ask FormSupport to store
PROCESS_SUBMISSION in its list of actions to do on submit.
        // If I contain other components, their actions will already be in
the list, before PROCESS_SUBMISSION. That is
        // because this method, afterRender(), is late in the sequence.
This guarantees PROCESS_SUBMISSION will be
        // executed on submit AFTER the components I contain are processed
(which includes their validation).

        if (formSupport != null) {
            formSupport.store(this, PROCESS_SUBMISSION);
        }
    }

    private static class ProcessSubmission implements
ComponentAction<LoanBundleEditTabs2> {
        private static final long serialVersionUID = -2132279249191788845L;

        @Override
        public String toString() {
            return this.getClass().getSimpleName() + ".ProcessSubmission";
        }

        @Override
        public void execute(LoanBundleEditTabs2 component) {
            component.processSubmission();
        }
    }

    private void processSubmission() {
        // Validate. We ensured in afterRender() that the components I
contain have already been validated.
        prepare();
    }

    @SetupRender
    void setup() {
        prepare();
    }

    void prepare() {
        Long loanApplicationId = loanApplication.getId();
        loanApplicationDetail =
loanApplicationDetailDao.getByApplicationId(loanApplicationId);

        homeAddress =
loanAddressDao.getHomeAddressByApplicationId(loanApplicationId);
        homeAddress2 = new AddressModel();
        addressCopier.copy(homeAddress, homeAddress2);

        mailAddress =
loanAddressDao.getMailAddressByApplicationId(loanApplicationId);
        mailAddress2 = new AddressModel();
        addressCopier.copy(mailAddress, mailAddress2);

        officeAddress =
loanAddressDao.getOfficeAddressByApplicationId(loanApplicationId);
        officeAddress2 = new AddressModel();
        addressCopier.copy(officeAddress, officeAddress2);
    }

Here's the stack trace

[ERROR] ioc.Registry Failure reading parameter 'source' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null.
[ERROR] ioc.Registry Operations trace:
[ERROR] ioc.Registry [ 1] Handling traditional 'action' component event
request for common/loan/ApplicationSummary:form.
[ERROR] ioc.Registry [ 2] Triggering event 'action' on
common/loan/ApplicationSummary:form
[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed
with uncaught exception:
org.apache.tapestry5.ioc.internal.OperationException: Failure reading
parameter 'source' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null. [at
classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
line 63]
org.apache.tapestry5.ioc.internal.OperationException: Failure reading
parameter 'source' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null. [at
classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
line 63]
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:186)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1260)
at
org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:154)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1043)
at
org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:73)
at
org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
at
org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:76)
at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$37.handle(TapestryModule.java:2216)
at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
at $ComponentEventRequestHandler_47d6beafe27e.handle(Unknown Source)
at
org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
at
org.apache.tapestry5.internal.services.DeferredResponseRenderer.handleComponentEvent(DeferredResponseRenderer.java:45)
at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
Source)
at
org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
Source)
at
org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:55)
at
org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:52)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1266)
at
org.apache.tapestry5.internal.services.RequestOperationTracker.handleComponentEvent(RequestOperationTracker.java:47)
at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
Source)
at
net.mreunionlabs.gri.server.infrastructure.PageProtectionFilter.handleComponentEvent(PageProtectionFilter.java:60)
at $ComponentRequestFilter_47d6beafe27d.handleComponentEvent(Unknown Source)
at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
Source)
at $ComponentRequestHandler_47d6beafe236.handleComponentEvent(Unknown
Source)
at
org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:48)
at $Dispatcher_47d6beafe238.dispatch(Unknown Source)
at $Dispatcher_47d6beafe22d.dispatch(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:305)
at
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
at $RequestHandler_47d6beafe22e.service(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$3.service(TapestryModule.java:846)
at $RequestHandler_47d6beafe22e.service(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$2.service(TapestryModule.java:836)
at $RequestHandler_47d6beafe22e.service(Unknown Source)
at
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:89)
at $RequestHandler_47d6beafe22e.service(Unknown Source)
at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
at
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
at $RequestHandler_47d6beafe22e.service(Unknown Source)
at $RequestHandler_47d6beafe223.service(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:256)
at
org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:45)
at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)
at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
at
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_47d6beafe21f.service(Unknown Source)
at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$1.service(TapestryModule.java:796)
at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
at $HttpServletRequestHandler_47d6beafe21e.service(Unknown Source)
at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:166)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at
org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
at
org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.tapestry5.runtime.ComponentEventException: Failure
reading parameter 'source' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null. [at
classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
line 63]
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1126)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3100(ComponentPageElementImpl.java:57)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1047)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1044)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
... 89 more
Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
Failure reading parameter 'source' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null. [at
classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 3]
at
org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:749)
at org.apache.tapestry5.corelib.components.Form.onAction(Form.java:516)
at
org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:917)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1102)
... 93 more
Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
Failure reading parameter 'source' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null. [at
classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 3]
at
org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:268)
at
org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
at
org.apache.tapestry5.corelib.components.Loop.conduit_get_source(Loop.java)
at
org.apache.tapestry5.corelib.components.Loop.setupForVolatile(Loop.java:356)
at org.apache.tapestry5.corelib.components.Loop.access$100(Loop.java:50)
at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:81)
at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:76)
at
org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:738)
... 97 more
Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null. [at
classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 3]
at
org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:67)
at
org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:263)
... 104 more
Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
to null. This parameter is not allowed to be null. [at
classpath:net/mreunionlabs/gri/server/components/gri/LoanBundleEditTabs2.tml,
line 67]
at
org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:276)
at
org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
at
org.apache.tapestry5.corelib.components.BeanDisplay.conduit_get_object(BeanDisplay.java)
at
org.apache.tapestry5.corelib.components.BeanDisplay.getModel(BeanDisplay.java:128)
at $InternalPropertyConduit_47d6beafe2e9.navigate(Unknown Source)
at $InternalPropertyConduit_47d6beafe2e9.get(Unknown Source)
at
org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:63)
... 105 more


--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
Reply | Threaded
Open this post in threaded view
|

Re: How to let custom component participate in form submission

Thiago H de Paula Figueiredo
Hello!

What exactly is this component trying to do? I couldn't get it by looking
at your code snippet.

Anyway, the probably best way of doing it if you want to create a component
which edits something is to subclass AbstractField.

The error message says you're trying to pass a null object to BeanDisplay
while it renders, so this doesn't seem to be a problem with form submission
at all, but a problem while rendering the page later.

Failure reading parameter 'source' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
Parameter 'object' of component
common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound


On Thu, Nov 1, 2018 at 4:43 AM abangkis <[hidden email]> wrote:

> Hai guys, still working on my custom component.
>
> How do we let our custom component participate in form submission.
> Apparently there is no onPrepare hook for tapestry custom component.
> http://tapestry.apache.org/component-rendering.html.
>
> I'm reading
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/component/subformvalidation1
> example. But still haven't grasp the general gist
> about ProcessSubmission/ComponentAction. Calling the prepare method from
> process submission doesn't seems to work. Rendering the component is fine,
> but when submitting the page I receive the error and stack trace bellow.
>
> Any advice? Thanks.
>
> Here's my custom component setup & prepare method:
>
>     private static final ProcessSubmission PROCESS_SUBMISSION = new
> ProcessSubmission();
>
>     // Tapestry calls afterRender() AFTER it renders any components I
> contain (ie. Loop).
>     final void afterRender() {
>
>         // If we are inside a form, ask FormSupport to store
> PROCESS_SUBMISSION in its list of actions to do on submit.
>         // If I contain other components, their actions will already be in
> the list, before PROCESS_SUBMISSION. That is
>         // because this method, afterRender(), is late in the sequence.
> This guarantees PROCESS_SUBMISSION will be
>         // executed on submit AFTER the components I contain are processed
> (which includes their validation).
>
>         if (formSupport != null) {
>             formSupport.store(this, PROCESS_SUBMISSION);
>         }
>     }
>
>     private static class ProcessSubmission implements
> ComponentAction<LoanBundleEditTabs2> {
>         private static final long serialVersionUID = -2132279249191788845L;
>
>         @Override
>         public String toString() {
>             return this.getClass().getSimpleName() + ".ProcessSubmission";
>         }
>
>         @Override
>         public void execute(LoanBundleEditTabs2 component) {
>             component.processSubmission();
>         }
>     }
>
>     private void processSubmission() {
>         // Validate. We ensured in afterRender() that the components I
> contain have already been validated.
>         prepare();
>     }
>
>     @SetupRender
>     void setup() {
>         prepare();
>     }
>
>     void prepare() {
>         Long loanApplicationId = loanApplication.getId();
>         loanApplicationDetail =
> loanApplicationDetailDao.getByApplicationId(loanApplicationId);
>
>         homeAddress =
> loanAddressDao.getHomeAddressByApplicationId(loanApplicationId);
>         homeAddress2 = new AddressModel();
>         addressCopier.copy(homeAddress, homeAddress2);
>
>         mailAddress =
> loanAddressDao.getMailAddressByApplicationId(loanApplicationId);
>         mailAddress2 = new AddressModel();
>         addressCopier.copy(mailAddress, mailAddress2);
>
>         officeAddress =
> loanAddressDao.getOfficeAddressByApplicationId(loanApplicationId);
>         officeAddress2 = new AddressModel();
>         addressCopier.copy(officeAddress, officeAddress2);
>     }
>
> Here's the stack trace
>
> [ERROR] ioc.Registry Failure reading parameter 'source' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null.
> [ERROR] ioc.Registry Operations trace:
> [ERROR] ioc.Registry [ 1] Handling traditional 'action' component event
> request for common/loan/ApplicationSummary:form.
> [ERROR] ioc.Registry [ 2] Triggering event 'action' on
> common/loan/ApplicationSummary:form
> [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed
> with uncaught exception:
> org.apache.tapestry5.ioc.internal.OperationException: Failure reading
> parameter 'source' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null. [at
>
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> line 63]
> org.apache.tapestry5.ioc.internal.OperationException: Failure reading
> parameter 'source' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null. [at
>
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> line 63]
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:186)
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
> at
>
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1260)
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:154)
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1043)
> at
>
> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:73)
> at
>
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
> at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> at
>
> org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:76)
> at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> at
>
> org.apache.tapestry5.modules.TapestryModule$37.handle(TapestryModule.java:2216)
> at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> at $ComponentEventRequestHandler_47d6beafe27e.handle(Unknown Source)
> at
>
> org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
> at
>
> org.apache.tapestry5.internal.services.DeferredResponseRenderer.handleComponentEvent(DeferredResponseRenderer.java:45)
> at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> Source)
> at
>
> org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
> at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> Source)
> at
>
> org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:55)
> at
>
> org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:52)
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
> at
>
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1266)
> at
>
> org.apache.tapestry5.internal.services.RequestOperationTracker.handleComponentEvent(RequestOperationTracker.java:47)
> at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> Source)
> at
>
> net.mreunionlabs.gri.server.infrastructure.PageProtectionFilter.handleComponentEvent(PageProtectionFilter.java:60)
> at $ComponentRequestFilter_47d6beafe27d.handleComponentEvent(Unknown
> Source)
> at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> Source)
> at $ComponentRequestHandler_47d6beafe236.handleComponentEvent(Unknown
> Source)
> at
>
> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:48)
> at $Dispatcher_47d6beafe238.dispatch(Unknown Source)
> at $Dispatcher_47d6beafe22d.dispatch(Unknown Source)
> at
>
> org.apache.tapestry5.modules.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:305)
> at
>
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
> at $RequestHandler_47d6beafe22e.service(Unknown Source)
> at
>
> org.apache.tapestry5.modules.TapestryModule$3.service(TapestryModule.java:846)
> at $RequestHandler_47d6beafe22e.service(Unknown Source)
> at
>
> org.apache.tapestry5.modules.TapestryModule$2.service(TapestryModule.java:836)
> at $RequestHandler_47d6beafe22e.service(Unknown Source)
> at
>
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:89)
> at $RequestHandler_47d6beafe22e.service(Unknown Source)
> at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
> at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
> at
>
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
> at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
> at $RequestHandler_47d6beafe22e.service(Unknown Source)
> at $RequestHandler_47d6beafe223.service(Unknown Source)
> at
>
> org.apache.tapestry5.modules.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:256)
> at
>
> org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:45)
> at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> at
> org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)
> at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> at
>
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
> at $HttpServletRequestFilter_47d6beafe21f.service(Unknown Source)
> at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> at
>
> org.apache.tapestry5.modules.TapestryModule$1.service(TapestryModule.java:796)
> at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> at $HttpServletRequestHandler_47d6beafe21e.service(Unknown Source)
> at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:166)
> at
>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
> at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
> at
>
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
> at
>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> at
>
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
> at
>
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
> at
>
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
> at
>
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
> at
>
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
> at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
> at
>
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
> at
>
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
> at
>
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
> at
>
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> at
>
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
> at
>
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
> at
>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> at org.eclipse.jetty.server.Server.handle(Server.java:564)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
> at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
> at
> org.eclipse.jetty.io
> .AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
> at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
> at
> org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
> at
>
> org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
> at
>
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
> at
>
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
> at
>
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
> at
>
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.tapestry5.runtime.ComponentEventException: Failure
> reading parameter 'source' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null. [at
>
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> line 63]
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1126)
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3100(ComponentPageElementImpl.java:57)
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1047)
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1044)
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
> ... 89 more
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> Failure reading parameter 'source' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null. [at
> classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 3]
> at
>
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:749)
> at org.apache.tapestry5.corelib.components.Form.onAction(Form.java:516)
> at
>
> org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:917)
> at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1102)
> ... 93 more
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> Failure reading parameter 'source' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null. [at
> classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 3]
> at
>
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:268)
> at
>
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
> at
> org.apache.tapestry5.corelib.components.Loop.conduit_get_source(Loop.java)
> at
>
> org.apache.tapestry5.corelib.components.Loop.setupForVolatile(Loop.java:356)
> at org.apache.tapestry5.corelib.components.Loop.access$100(Loop.java:50)
> at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:81)
> at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:76)
> at
>
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:738)
> ... 97 more
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null. [at
> classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 3]
> at
> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:67)
> at
>
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:263)
> ... 104 more
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> to null. This parameter is not allowed to be null. [at
>
> classpath:net/mreunionlabs/gri/server/components/gri/LoanBundleEditTabs2.tml,
> line 67]
> at
>
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:276)
> at
>
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
> at
>
> org.apache.tapestry5.corelib.components.BeanDisplay.conduit_get_object(BeanDisplay.java)
> at
>
> org.apache.tapestry5.corelib.components.BeanDisplay.getModel(BeanDisplay.java:128)
> at $InternalPropertyConduit_47d6beafe2e9.navigate(Unknown Source)
> at $InternalPropertyConduit_47d6beafe2e9.get(Unknown Source)
> at
> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:63)
> ... 105 more
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


--
Thiago
Reply | Threaded
Open this post in threaded view
|

Re: How to let custom component participate in form submission

abangkis
Hi Thiago,

This component is some ui that we extract from few common pages. It shows a
series of tabs. Each tabs has its own related Hibernate Entity. We don't
pass all the tabs entity as parameter to the component. Instead we just
pass the root component and let the rest of the tab get their entity from
the DAO injected to the component.

The component is encapsulated inside of a form. It works well showing the
data for each tab. But when we submit the form we receive that error. Since
the tabs Hibernate Entity is not Persist in the component. Our approach is
to use @Persist only when we have to. Usually this is handled in the page
by populating the tabs Hibernate Entities in the page OnPrepare method.
Translating this approach from a page implementation to the custom
component isn't as straight forward as I thought. Since OnPrepare isn't
called in the custom component. (it's part of page life cycle but not part
of component rendering lifecycle?)

Tried to implement it using Process Submission example from jumpstart
(since it seems that's how you implement a component that contribute the
value to form submission process). But still haven't got it working yet.

By the way. Is it common to have @Persist property inside of a component?
How do you clean the persisted field after submission? Is it enough only by
calling ComponentResources.discardPersistentField() on the page OnSucces
method? Or do we need to clean it up on the Component Java code instead?

Sorry if the explanation a bit long and confusing. Thanks.






On Thu, Nov 1, 2018 at 8:41 PM Thiago H. de Paula Figueiredo <
[hidden email]> wrote:

> Hello!
>
> What exactly is this component trying to do? I couldn't get it by looking
> at your code snippet.
>
> Anyway, the probably best way of doing it if you want to create a component
> which edits something is to subclass AbstractField.
>
> The error message says you're trying to pass a null object to BeanDisplay
> while it renders, so this doesn't seem to be a problem with form submission
> at all, but a problem while rendering the page later.
>
> Failure reading parameter 'source' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> Parameter 'object' of component
> common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
>
>
> On Thu, Nov 1, 2018 at 4:43 AM abangkis <[hidden email]> wrote:
>
> > Hai guys, still working on my custom component.
> >
> > How do we let our custom component participate in form submission.
> > Apparently there is no onPrepare hook for tapestry custom component.
> > http://tapestry.apache.org/component-rendering.html.
> >
> > I'm reading
> >
> >
> http://jumpstart.doublenegative.com.au/jumpstart/examples/component/subformvalidation1
> > example. But still haven't grasp the general gist
> > about ProcessSubmission/ComponentAction. Calling the prepare method from
> > process submission doesn't seems to work. Rendering the component is
> fine,
> > but when submitting the page I receive the error and stack trace bellow.
> >
> > Any advice? Thanks.
> >
> > Here's my custom component setup & prepare method:
> >
> >     private static final ProcessSubmission PROCESS_SUBMISSION = new
> > ProcessSubmission();
> >
> >     // Tapestry calls afterRender() AFTER it renders any components I
> > contain (ie. Loop).
> >     final void afterRender() {
> >
> >         // If we are inside a form, ask FormSupport to store
> > PROCESS_SUBMISSION in its list of actions to do on submit.
> >         // If I contain other components, their actions will already be
> in
> > the list, before PROCESS_SUBMISSION. That is
> >         // because this method, afterRender(), is late in the sequence.
> > This guarantees PROCESS_SUBMISSION will be
> >         // executed on submit AFTER the components I contain are
> processed
> > (which includes their validation).
> >
> >         if (formSupport != null) {
> >             formSupport.store(this, PROCESS_SUBMISSION);
> >         }
> >     }
> >
> >     private static class ProcessSubmission implements
> > ComponentAction<LoanBundleEditTabs2> {
> >         private static final long serialVersionUID =
> -2132279249191788845L;
> >
> >         @Override
> >         public String toString() {
> >             return this.getClass().getSimpleName() +
> ".ProcessSubmission";
> >         }
> >
> >         @Override
> >         public void execute(LoanBundleEditTabs2 component) {
> >             component.processSubmission();
> >         }
> >     }
> >
> >     private void processSubmission() {
> >         // Validate. We ensured in afterRender() that the components I
> > contain have already been validated.
> >         prepare();
> >     }
> >
> >     @SetupRender
> >     void setup() {
> >         prepare();
> >     }
> >
> >     void prepare() {
> >         Long loanApplicationId = loanApplication.getId();
> >         loanApplicationDetail =
> > loanApplicationDetailDao.getByApplicationId(loanApplicationId);
> >
> >         homeAddress =
> > loanAddressDao.getHomeAddressByApplicationId(loanApplicationId);
> >         homeAddress2 = new AddressModel();
> >         addressCopier.copy(homeAddress, homeAddress2);
> >
> >         mailAddress =
> > loanAddressDao.getMailAddressByApplicationId(loanApplicationId);
> >         mailAddress2 = new AddressModel();
> >         addressCopier.copy(mailAddress, mailAddress2);
> >
> >         officeAddress =
> > loanAddressDao.getOfficeAddressByApplicationId(loanApplicationId);
> >         officeAddress2 = new AddressModel();
> >         addressCopier.copy(officeAddress, officeAddress2);
> >     }
> >
> > Here's the stack trace
> >
> > [ERROR] ioc.Registry Failure reading parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null.
> > [ERROR] ioc.Registry Operations trace:
> > [ERROR] ioc.Registry [ 1] Handling traditional 'action' component event
> > request for common/loan/ApplicationSummary:form.
> > [ERROR] ioc.Registry [ 2] Triggering event 'action' on
> > common/loan/ApplicationSummary:form
> > [ERROR] TapestryModule.RequestExceptionHandler Processing of request
> failed
> > with uncaught exception:
> > org.apache.tapestry5.ioc.internal.OperationException: Failure reading
> > parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null. [at
> >
> >
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> > line 63]
> > org.apache.tapestry5.ioc.internal.OperationException: Failure reading
> > parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null. [at
> >
> >
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> > line 63]
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:186)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1260)
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:154)
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1043)
> > at
> >
> >
> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:73)
> > at
> >
> >
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
> > at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:76)
> > at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$37.handle(TapestryModule.java:2216)
> > at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> > at $ComponentEventRequestHandler_47d6beafe27e.handle(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
> > at
> >
> >
> org.apache.tapestry5.internal.services.DeferredResponseRenderer.handleComponentEvent(DeferredResponseRenderer.java:45)
> > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > Source)
> > at
> >
> >
> org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
> > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:55)
> > at
> >
> >
> org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:52)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1266)
> > at
> >
> >
> org.apache.tapestry5.internal.services.RequestOperationTracker.handleComponentEvent(RequestOperationTracker.java:47)
> > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > Source)
> > at
> >
> >
> net.mreunionlabs.gri.server.infrastructure.PageProtectionFilter.handleComponentEvent(PageProtectionFilter.java:60)
> > at $ComponentRequestFilter_47d6beafe27d.handleComponentEvent(Unknown
> > Source)
> > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > Source)
> > at $ComponentRequestHandler_47d6beafe236.handleComponentEvent(Unknown
> > Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:48)
> > at $Dispatcher_47d6beafe238.dispatch(Unknown Source)
> > at $Dispatcher_47d6beafe22d.dispatch(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:305)
> > at
> >
> >
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
> > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$3.service(TapestryModule.java:846)
> > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$2.service(TapestryModule.java:836)
> > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:89)
> > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
> > at
> >
> >
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
> > at
> >
> >
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
> > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > at $RequestHandler_47d6beafe223.service(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:256)
> > at
> >
> >
> org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:45)
> > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > at
> > org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)
> > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
> > at $HttpServletRequestFilter_47d6beafe21f.service(Unknown Source)
> > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > at
> >
> >
> org.apache.tapestry5.modules.TapestryModule$1.service(TapestryModule.java:796)
> > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > at $HttpServletRequestHandler_47d6beafe21e.service(Unknown Source)
> > at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:166)
> > at
> >
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
> > at
> >
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> > at
> >
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
> > at
> >
> >
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
> > at
> >
> >
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
> > at
> > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
> > at
> >
> >
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> > at
> >
> >
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
> > at
> >
> >
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
> > at
> >
> >
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> > at org.eclipse.jetty.server.Server.handle(Server.java:564)
> > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
> > at
> >
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
> > at
> > org.eclipse.jetty.io
> > .AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
> > at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
> > at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
> > at
> >
> org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
> > at
> >
> >
> org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
> > at
> >
> >
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
> > at
> >
> >
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
> > at
> >
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
> > at
> >
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
> > at java.lang.Thread.run(Thread.java:748)
> > Caused by: org.apache.tapestry5.runtime.ComponentEventException: Failure
> > reading parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null. [at
> >
> >
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> > line 63]
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1126)
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3100(ComponentPageElementImpl.java:57)
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1047)
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1044)
> > at
> >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
> > ... 89 more
> > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > Failure reading parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null. [at
> > classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line
> 3]
> > at
> >
> >
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:749)
> > at org.apache.tapestry5.corelib.components.Form.onAction(Form.java:516)
> > at
> >
> >
> org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:917)
> > at
> >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1102)
> > ... 93 more
> > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > Failure reading parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null. [at
> > classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line
> 3]
> > at
> >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:268)
> > at
> >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
> > at
> >
> org.apache.tapestry5.corelib.components.Loop.conduit_get_source(Loop.java)
> > at
> >
> >
> org.apache.tapestry5.corelib.components.Loop.setupForVolatile(Loop.java:356)
> > at org.apache.tapestry5.corelib.components.Loop.access$100(Loop.java:50)
> > at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:81)
> > at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:76)
> > at
> >
> >
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:738)
> > ... 97 more
> > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null. [at
> > classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line
> 3]
> > at
> >
> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:67)
> > at
> >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:263)
> > ... 104 more
> > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> > to null. This parameter is not allowed to be null. [at
> >
> >
> classpath:net/mreunionlabs/gri/server/components/gri/LoanBundleEditTabs2.tml,
> > line 67]
> > at
> >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:276)
> > at
> >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
> > at
> >
> >
> org.apache.tapestry5.corelib.components.BeanDisplay.conduit_get_object(BeanDisplay.java)
> > at
> >
> >
> org.apache.tapestry5.corelib.components.BeanDisplay.getModel(BeanDisplay.java:128)
> > at $InternalPropertyConduit_47d6beafe2e9.navigate(Unknown Source)
> > at $InternalPropertyConduit_47d6beafe2e9.get(Unknown Source)
> > at
> >
> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:63)
> > ... 105 more
> >
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
> --
> Thiago
>


--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
Reply | Threaded
Open this post in threaded view
|

Re: How to let custom component participate in form submission

Chris Poulsen
Hi

It sounds like you are attempting to do something in a way that may not be
ideal (judging from all the hoops you are trying to jump through).

In Tapestry you can usually get really far using the simple building blocks
that are provided. With a few exceptions you are usually taking a bad
course, when you think you need to write all kinds of weird code to make
the framework happy (Exceptions are usually things like when the (complex)
built-in components like grid and tree does not support what you need).

You seem to have a somewhat unclear understanding of component rendering
and form submissions, that could be a place to start. (Hint. take a look at
the Form component
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html
- That is the one that triggers those prepare* events etc, there is no
magic going on in pages with respect to that. As events bubble "up" through
containers, you should not expect your component to receive those events if
it is _inside_ the form. If you want something complex acting like a form
element, use Thiagos suggestion).

I would recommend against trying to implement some kind of pub/sub
mechanism to circumvent the fact that you feel your components are
misbehaving because events bubble up... - It may be possible to get
something to work, but with respect to maintenance and component
re-usability you will most likely end up realizing that you have shoot
yourself in the foot, at some point.

With a few exceptions, I would generally say that using @Persist in
components is a smell, instead pass the information as a parameter - Pages
are ultimately the things driving the components, they should worry about
how to configure the components (if that means that a value should be
persisted, it should happen in the page).

Also if you find yourself needing page life-cycle callbacks in your
component (e.g my component should do this on activate or similar, you are
doing it wrong)

It is hard to come up with something concrete based on the info provided,
but I guess that if you realize how form submission and component render
life cycles interact, it will be easier to fix your problem.

--
Chris





On Thu, Nov 1, 2018 at 3:53 PM abangkis <[hidden email]> wrote:

> Hi Thiago,
>
> This component is some ui that we extract from few common pages. It shows a
> series of tabs. Each tabs has its own related Hibernate Entity. We don't
> pass all the tabs entity as parameter to the component. Instead we just
> pass the root component and let the rest of the tab get their entity from
> the DAO injected to the component.
>
> The component is encapsulated inside of a form. It works well showing the
> data for each tab. But when we submit the form we receive that error. Since
> the tabs Hibernate Entity is not Persist in the component. Our approach is
> to use @Persist only when we have to. Usually this is handled in the page
> by populating the tabs Hibernate Entities in the page OnPrepare method.
> Translating this approach from a page implementation to the custom
> component isn't as straight forward as I thought. Since OnPrepare isn't
> called in the custom component. (it's part of page life cycle but not part
> of component rendering lifecycle?)
>
> Tried to implement it using Process Submission example from jumpstart
> (since it seems that's how you implement a component that contribute the
> value to form submission process). But still haven't got it working yet.
>
> By the way. Is it common to have @Persist property inside of a component?
> How do you clean the persisted field after submission? Is it enough only by
> calling ComponentResources.discardPersistentField() on the page OnSucces
> method? Or do we need to clean it up on the Component Java code instead?
>
> Sorry if the explanation a bit long and confusing. Thanks.
>
>
>
>
>
>
> On Thu, Nov 1, 2018 at 8:41 PM Thiago H. de Paula Figueiredo <
> [hidden email]> wrote:
>
> > Hello!
> >
> > What exactly is this component trying to do? I couldn't get it by looking
> > at your code snippet.
> >
> > Anyway, the probably best way of doing it if you want to create a
> component
> > which edits something is to subclass AbstractField.
> >
> > The error message says you're trying to pass a null object to BeanDisplay
> > while it renders, so this doesn't seem to be a problem with form
> submission
> > at all, but a problem while rendering the page later.
> >
> > Failure reading parameter 'source' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > Parameter 'object' of component
> > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is bound
> >
> >
> > On Thu, Nov 1, 2018 at 4:43 AM abangkis <[hidden email]> wrote:
> >
> > > Hai guys, still working on my custom component.
> > >
> > > How do we let our custom component participate in form submission.
> > > Apparently there is no onPrepare hook for tapestry custom component.
> > > http://tapestry.apache.org/component-rendering.html.
> > >
> > > I'm reading
> > >
> > >
> >
> http://jumpstart.doublenegative.com.au/jumpstart/examples/component/subformvalidation1
> > > example. But still haven't grasp the general gist
> > > about ProcessSubmission/ComponentAction. Calling the prepare method
> from
> > > process submission doesn't seems to work. Rendering the component is
> > fine,
> > > but when submitting the page I receive the error and stack trace
> bellow.
> > >
> > > Any advice? Thanks.
> > >
> > > Here's my custom component setup & prepare method:
> > >
> > >     private static final ProcessSubmission PROCESS_SUBMISSION = new
> > > ProcessSubmission();
> > >
> > >     // Tapestry calls afterRender() AFTER it renders any components I
> > > contain (ie. Loop).
> > >     final void afterRender() {
> > >
> > >         // If we are inside a form, ask FormSupport to store
> > > PROCESS_SUBMISSION in its list of actions to do on submit.
> > >         // If I contain other components, their actions will already be
> > in
> > > the list, before PROCESS_SUBMISSION. That is
> > >         // because this method, afterRender(), is late in the sequence.
> > > This guarantees PROCESS_SUBMISSION will be
> > >         // executed on submit AFTER the components I contain are
> > processed
> > > (which includes their validation).
> > >
> > >         if (formSupport != null) {
> > >             formSupport.store(this, PROCESS_SUBMISSION);
> > >         }
> > >     }
> > >
> > >     private static class ProcessSubmission implements
> > > ComponentAction<LoanBundleEditTabs2> {
> > >         private static final long serialVersionUID =
> > -2132279249191788845L;
> > >
> > >         @Override
> > >         public String toString() {
> > >             return this.getClass().getSimpleName() +
> > ".ProcessSubmission";
> > >         }
> > >
> > >         @Override
> > >         public void execute(LoanBundleEditTabs2 component) {
> > >             component.processSubmission();
> > >         }
> > >     }
> > >
> > >     private void processSubmission() {
> > >         // Validate. We ensured in afterRender() that the components I
> > > contain have already been validated.
> > >         prepare();
> > >     }
> > >
> > >     @SetupRender
> > >     void setup() {
> > >         prepare();
> > >     }
> > >
> > >     void prepare() {
> > >         Long loanApplicationId = loanApplication.getId();
> > >         loanApplicationDetail =
> > > loanApplicationDetailDao.getByApplicationId(loanApplicationId);
> > >
> > >         homeAddress =
> > > loanAddressDao.getHomeAddressByApplicationId(loanApplicationId);
> > >         homeAddress2 = new AddressModel();
> > >         addressCopier.copy(homeAddress, homeAddress2);
> > >
> > >         mailAddress =
> > > loanAddressDao.getMailAddressByApplicationId(loanApplicationId);
> > >         mailAddress2 = new AddressModel();
> > >         addressCopier.copy(mailAddress, mailAddress2);
> > >
> > >         officeAddress =
> > > loanAddressDao.getOfficeAddressByApplicationId(loanApplicationId);
> > >         officeAddress2 = new AddressModel();
> > >         addressCopier.copy(officeAddress, officeAddress2);
> > >     }
> > >
> > > Here's the stack trace
> > >
> > > [ERROR] ioc.Registry Failure reading parameter 'source' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null.
> > > [ERROR] ioc.Registry Operations trace:
> > > [ERROR] ioc.Registry [ 1] Handling traditional 'action' component event
> > > request for common/loan/ApplicationSummary:form.
> > > [ERROR] ioc.Registry [ 2] Triggering event 'action' on
> > > common/loan/ApplicationSummary:form
> > > [ERROR] TapestryModule.RequestExceptionHandler Processing of request
> > failed
> > > with uncaught exception:
> > > org.apache.tapestry5.ioc.internal.OperationException: Failure reading
> > > parameter 'source' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null. [at
> > >
> > >
> >
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> > > line 63]
> > > org.apache.tapestry5.ioc.internal.OperationException: Failure reading
> > > parameter 'source' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null. [at
> > >
> > >
> >
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> > > line 63]
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:186)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1260)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:154)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1043)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:73)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
> > > at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:76)
> > > at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.modules.TapestryModule$37.handle(TapestryModule.java:2216)
> > > at $ComponentEventRequestHandler_47d6beafe399.handle(Unknown Source)
> > > at $ComponentEventRequestHandler_47d6beafe27e.handle(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.DeferredResponseRenderer.handleComponentEvent(DeferredResponseRenderer.java:45)
> > > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > > Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
> > > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > > Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:55)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:52)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1266)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.RequestOperationTracker.handleComponentEvent(RequestOperationTracker.java:47)
> > > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > > Source)
> > > at
> > >
> > >
> >
> net.mreunionlabs.gri.server.infrastructure.PageProtectionFilter.handleComponentEvent(PageProtectionFilter.java:60)
> > > at $ComponentRequestFilter_47d6beafe27d.handleComponentEvent(Unknown
> > > Source)
> > > at $ComponentRequestHandler_47d6beafe280.handleComponentEvent(Unknown
> > > Source)
> > > at $ComponentRequestHandler_47d6beafe236.handleComponentEvent(Unknown
> > > Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:48)
> > > at $Dispatcher_47d6beafe238.dispatch(Unknown Source)
> > > at $Dispatcher_47d6beafe22d.dispatch(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.modules.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:305)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
> > > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.modules.TapestryModule$3.service(TapestryModule.java:846)
> > > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.modules.TapestryModule$2.service(TapestryModule.java:836)
> > > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:89)
> > > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
> > > at $RequestHandler_47d6beafe22e.service(Unknown Source)
> > > at $RequestHandler_47d6beafe223.service(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.modules.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:256)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:45)
> > > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > > at
> > >
> org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)
> > > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
> > > at $HttpServletRequestFilter_47d6beafe21f.service(Unknown Source)
> > > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.modules.TapestryModule$1.service(TapestryModule.java:796)
> > > at $HttpServletRequestHandler_47d6beafe225.service(Unknown Source)
> > > at $HttpServletRequestHandler_47d6beafe21e.service(Unknown Source)
> > > at
> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:166)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
> > > at
> > >
> >
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> > > at
> > >
> >
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
> > > at
> > >
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> > > at org.eclipse.jetty.server.Server.handle(Server.java:564)
> > > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
> > > at
> > >
> >
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
> > > at
> > > org.eclipse.jetty.io
> > > .AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
> > > at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
> > > at org.eclipse.jetty.io
> .ChannelEndPoint$2.run(ChannelEndPoint.java:124)
> > > at
> > >
> >
> org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
> > > at
> > >
> > >
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
> > > at java.lang.Thread.run(Thread.java:748)
> > > Caused by: org.apache.tapestry5.runtime.ComponentEventException:
> Failure
> > > reading parameter 'source' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null. [at
> > >
> > >
> >
> classpath:net/mreunionlabs/gri/server/pages/common/loan/LoanApplicationSummary.tml,
> > > line 63]
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1126)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3100(ComponentPageElementImpl.java:57)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1047)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1044)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
> > > ... 89 more
> > > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > > Failure reading parameter 'source' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null. [at
> > > classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line
> > 3]
> > > at
> > >
> > >
> >
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:749)
> > > at org.apache.tapestry5.corelib.components.Form.onAction(Form.java:516)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:917)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1102)
> > > ... 93 more
> > > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > > Failure reading parameter 'source' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0.loop:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null. [at
> > > classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line
> > 3]
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:268)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
> > > at
> > >
> >
> org.apache.tapestry5.corelib.components.Loop.conduit_get_source(Loop.java)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.corelib.components.Loop.setupForVolatile(Loop.java:356)
> > > at
> org.apache.tapestry5.corelib.components.Loop.access$100(Loop.java:50)
> > > at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:81)
> > > at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:76)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:738)
> > > ... 97 more
> > > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null. [at
> > > classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line
> > 3]
> > > at
> > >
> >
> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:67)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:263)
> > > ... 104 more
> > > Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
> > > Parameter 'object' of component
> > > common/loan/ApplicationSummary:loanbundleedittabs2.beandisplay_0 is
> bound
> > > to null. This parameter is not allowed to be null. [at
> > >
> > >
> >
> classpath:net/mreunionlabs/gri/server/components/gri/LoanBundleEditTabs2.tml,
> > > line 67]
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:276)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.corelib.components.BeanDisplay.conduit_get_object(BeanDisplay.java)
> > > at
> > >
> > >
> >
> org.apache.tapestry5.corelib.components.BeanDisplay.getModel(BeanDisplay.java:128)
> > > at $InternalPropertyConduit_47d6beafe2e9.navigate(Unknown Source)
> > > at $InternalPropertyConduit_47d6beafe2e9.get(Unknown Source)
> > > at
> > >
> >
> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:63)
> > > ... 105 more
> > >
> > >
> > > --
> > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > twitter : @mreunionlabs @abangkis
> > > page : https://plus.google.com/104168782385184990771
> > >
> >
> >
> > --
> > Thiago
> >
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>
Reply | Threaded
Open this post in threaded view
|

Re: How to let custom component participate in form submission

abangkis
Hi chris, thanks for the reply.


On Sun, Nov 4, 2018 at 8:19 PM Chris Poulsen <[hidden email]> wrote:

>
> With a few exceptions, I would generally say that using @Persist in
> components is a smell, instead pass the information as a parameter - Pages
> are ultimately the things driving the components, they should worry about
> how to configure the components (if that means that a value should be
> persisted, it should happen in the page).
>
>
Yes, we currently uses this approach. Thanks a lot.