You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bob Harner <bo...@gmail.com> on 2013/10/16 13:01:08 UTC

Re: T5.4 ajax select menu bug

I noticed a couple of days ago in 5.4 alpha 22 that the SelectModel is now
being used on form render AND submission whereas it used to be used only on
render of the form. This is a big deal performance-wise because creation of
the SelectModel commonly involves a database query to populated a list of
objects.

I haven't yet spent the time to look at this closely to see if I am doing
something wrong, but it looks like a regression to me.
On Oct 15, 2013 11:33 PM, "George Christman" <gc...@cardaddy.com>
wrote:

> Some additional information, this appears to last work correctly in version
> 5.4-alpha-20, but becomes broken in 5.4-alpha-21 - current.
>
>
> On Tue, Oct 15, 2013 at 11:09 PM, George Christman
> <gc...@cardaddy.com>wrote:
>
> > Hello, I have a year, make, model select menu in my application. I set
> the
> > model of the current menu based on the previous select menu using the
> > onValueChanged event and ajax zone component.  The select menu in T.4.22
> > appears to be calling the SelectModel before it calls the onValueChanged
> > event resulting in the following exception.
> >
> > org.apache.tapestry5.ioc.internal.util.TapestryException
> >
> > *Parameter 'model' of component Test:carmake is bound to null. This
> > parameter is not allowed to be null.*
> > locationclasspath:org/company/tapdemo/pages/Test.tml, line 9
> >
> > I used Geoff's example from jumpstart found below as a test to find the
> > same issue still existed in 4.22. I tried the example in 3.7 and didn't
> > experience any issues. Should I file a bug?
> >
> >
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/selectmore1
> >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
> >
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>

Re: T5.4 ajax select menu bug

Posted by Lance Java <la...@googlemail.com>.
I think the secure parameter should default to a symbol. And the default
for the symbol should be false

Re: T5.4 ajax select menu bug

Posted by George Christman <gc...@cardaddy.com>.
I completely agree with you Bob, it broke my code and left me going in
circles trying to figure out why all of a sudden I was getting these select
exceptions when I was implementing the component no differently than I have
have.


On Wed, Oct 16, 2013 at 2:03 PM, Bob Harner <bo...@gmail.com> wrote:

> The work-around of setting the secure parameter to "false" works for me (if
> I do it on *all* the selects in the form).
>
> The issue was caused by the fix for TAP5-2179 ("The Select component can be
> hacked to select a value not in the SelectModel").
>
> I agree with Lance that the secure parameter's default should be changed to
> false, because 1) defaulting to "true" is a breaking change, 2) I'm not
> sure TAP5-2179 was really a significant problem for most apps, and 3) there
> are significant performance implications. (Requiring the SelectModel to
> exist when the form is submitted either requires a (potentially large) list
> of objects to be persisted in the session or a (potentially large) list of
> objects to be recreated from a database query.)
>
> Anybody else have an opinion on this?
>
>
>
> On Wed, Oct 16, 2013 at 10:03 AM, George Christman
> <gc...@cardaddy.com>wrote:
>
> > filed jira issue
> >
> > https://issues.apache.org/jira/browse/TAP5-2204
> >
> >
> > On Wed, Oct 16, 2013 at 10:03 AM, George Christman
> > <gc...@cardaddy.com>wrote:
> >
> > > It's still failing with secure="false", the only way to get it to work
> is
> > > to @Persist SelectModel computerModels.
> > >
> > > btw, the onValueChanged method in my above example should be
> > > onValueChangedFromComputer.
> > >
> > >
> > > On Wed, Oct 16, 2013 at 9:38 AM, Lance Java <lance.java@googlemail.com
> > >wrote:
> > >
> > >> It seems like a new 'secure' parameter has been added to select which
> > >> defaults to true (value must exist in the model).
> > >>
> > >> Try setting secure="false"
> > >>
> > >> I think this should be the default to maintain backwards
> compatibility.
> > >>
> > >
> > >
> > >
> > > --
> > > George Christman
> > > www.CarDaddy.com
> > > P.O. Box 735
> > > Johnstown, New York
> > >
> > >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: T5.4 ajax select menu bug

Posted by Bob Harner <bo...@gmail.com>.
The work-around of setting the secure parameter to "false" works for me (if
I do it on *all* the selects in the form).

The issue was caused by the fix for TAP5-2179 ("The Select component can be
hacked to select a value not in the SelectModel").

I agree with Lance that the secure parameter's default should be changed to
false, because 1) defaulting to "true" is a breaking change, 2) I'm not
sure TAP5-2179 was really a significant problem for most apps, and 3) there
are significant performance implications. (Requiring the SelectModel to
exist when the form is submitted either requires a (potentially large) list
of objects to be persisted in the session or a (potentially large) list of
objects to be recreated from a database query.)

Anybody else have an opinion on this?



On Wed, Oct 16, 2013 at 10:03 AM, George Christman
<gc...@cardaddy.com>wrote:

> filed jira issue
>
> https://issues.apache.org/jira/browse/TAP5-2204
>
>
> On Wed, Oct 16, 2013 at 10:03 AM, George Christman
> <gc...@cardaddy.com>wrote:
>
> > It's still failing with secure="false", the only way to get it to work is
> > to @Persist SelectModel computerModels.
> >
> > btw, the onValueChanged method in my above example should be
> > onValueChangedFromComputer.
> >
> >
> > On Wed, Oct 16, 2013 at 9:38 AM, Lance Java <lance.java@googlemail.com
> >wrote:
> >
> >> It seems like a new 'secure' parameter has been added to select which
> >> defaults to true (value must exist in the model).
> >>
> >> Try setting secure="false"
> >>
> >> I think this should be the default to maintain backwards compatibility.
> >>
> >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
> >
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>

Re: T5.4 ajax select menu bug

Posted by George Christman <gc...@cardaddy.com>.
filed jira issue

https://issues.apache.org/jira/browse/TAP5-2204


On Wed, Oct 16, 2013 at 10:03 AM, George Christman
<gc...@cardaddy.com>wrote:

> It's still failing with secure="false", the only way to get it to work is
> to @Persist SelectModel computerModels.
>
> btw, the onValueChanged method in my above example should be
> onValueChangedFromComputer.
>
>
> On Wed, Oct 16, 2013 at 9:38 AM, Lance Java <la...@googlemail.com>wrote:
>
>> It seems like a new 'secure' parameter has been added to select which
>> defaults to true (value must exist in the model).
>>
>> Try setting secure="false"
>>
>> I think this should be the default to maintain backwards compatibility.
>>
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: T5.4 ajax select menu bug

Posted by George Christman <gc...@cardaddy.com>.
It's still failing with secure="false", the only way to get it to work is
to @Persist SelectModel computerModels.

btw, the onValueChanged method in my above example should be
onValueChangedFromComputer.


On Wed, Oct 16, 2013 at 9:38 AM, Lance Java <la...@googlemail.com>wrote:

> It seems like a new 'secure' parameter has been added to select which
> defaults to true (value must exist in the model).
>
> Try setting secure="false"
>
> I think this should be the default to maintain backwards compatibility.
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: T5.4 ajax select menu bug

Posted by Lance Java <la...@googlemail.com>.
It seems like a new 'secure' parameter has been added to select which
defaults to true (value must exist in the model).

Try setting secure="false"

I think this should be the default to maintain backwards compatibility.

Re: T5.4 ajax select menu bug

Posted by George Christman <gc...@cardaddy.com>.
Sample code and full stack. I'm at my day job and unable to recreate my
actual data model, so please keep in mind I use a multi tier selection
model, ie Category, Year, Make, Model, Trim. This worked without issue
prior to 5.4.21. The selectModel data is dependent upon the select model
value, so I'm unable to rebuild this using onPrepare. It can be persisted,
however this isn't the most ideal repair.

<html t:type="layout" t:title="Select Demo" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
    <form t:type="form">
        <select t:type="select" t:id="computer" t:model="computerModels"
t:zone="ajaxZone"/>

        <t:zone t:id="ajaxZone" id="ajaxZone">
            <select t:type="select"t t:id="monitor"
t:model="monitorModels"/>
        </t:zone>
    </form>
</html>

public class SelectDemo {

    @Property
    private Computer computer;
    @Property
    private Monitor monitor;
    @Property
    private SelectModel computerModels;
    @Property
    private SelectModel monitorModels;
    @Inject
    private SelectModelFactory selectModelFactory;
    @InjectComponent
    private Zone ajaxZone;
    @Inject
    private Session session;

    public void setupRender() {
        List<Computer> computers =
session.createCriteria(Computer.class).list();
        computerModels = selectModelFactory.create(computers, "name");
        monitorModels = selectModelFactory.create(new ArrayList<>());
    }

    Object onValueChangedFromMonitor(Computer computer) {
        List<Monitor> monitors =
session.createCriteria(Monitor.class).add(Restrictions.eq("computer",
computer)).list();
        monitorModels = selectModelFactory.create(monitors, "name");
        return ajaxZone.getBody();
    }
}


The full stack trace



   - Application Exception
   -
   -

   Tapestry Version: 5.4-alpha-22
   -
   -

   Application Version: 1.1-SNAPSHOT-DEV

An exception has occurred processing this request.
Parameter 'model' of component SelectDemo:computer is bound to null. This
parameter is not allowed to be null.
org.apache.tapestry5.ioc.internal.OperationException

*Parameter 'model' of component SelectDemo:computer is bound to null. This
parameter is not allowed to be null.*
locationclasspath:org/company/tapdemo/pages/SelectDemo.tml, line 31<html
t:type="layout" t:title="Select Demo" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">2 <form t:type="form">3 <select
t:type="select" t:id="computer" t:model="computerModels" t:zone="ajaxZone"/>
4
5 <t:zone t:id="ajaxZone" id="ajaxZone">6 <select t:type="select"
t:id="monitor" t:model="monitorModels"/>7 </t:zone>8 </form>trace

   - Handling Ajax 'change' component event request for SelectDemo:computer.
   - Triggering event 'change' on SelectDemo:computer

org.apache.tapestry5.runtime.ComponentEventException

*Parameter 'model' of component SelectDemo:computer is bound to null. This
parameter is not allowed to be null.*
context
eventTypechangelocationclasspath:org/company/tapdemo/pages/SelectDemo.tml,
line 3
org.apache.tapestry5.ioc.internal.util.TapestryException

*Parameter 'model' of component SelectDemo:computer is bound to null. This
parameter is not allowed to be null.*
locationclasspath:org/company/tapdemo/pages/SelectDemo.tml, line 3
Filter Frames?
Stack trace:

   - org.apache.tapestry5.internal.transform.ParameterWorker$3$1.readFromBinding(ParameterWorker.java:275)

   - org.apache.tapestry5.internal.transform.ParameterWorker$3$1.get(ParameterWorker.java:381)

   - org.apache.tapestry5.corelib.components.Select.findValueInModel(Select.java:273)

   - org.apache.tapestry5.corelib.components.Select.toValue(Select.java:262)

   - org.apache.tapestry5.corelib.components.Select.onChange(Select.java:238)

   - org.apache.tapestry5.corelib.components.Select.dispatchComponentEvent(Select.java)

   - org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:950)

   - org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1127)

   - org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1072)

   - org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1069)

   - org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:145)

   - org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1068)

   - org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:109)

   - org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateFilter.handle(AjaxFormUpdateFilter.java:56)

   - org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)

   - org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75)

   - org.apache.tapestry5.modules.TapestryModule$37.handle(TapestryModule.java:2185)

   - org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)

   - org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)

   - org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:55)

   - org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:52)

   - org.apache.tapestry5.internal.services.RequestOperationTracker.handleComponentEvent(RequestOperationTracker.java:47)

   - org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)

   - org.apache.tapestry5.modules.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:299)

   - org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)

   - org.apache.tapestry5.modules.TapestryModule$3.service(TapestryModule.java:844)

   - org.apache.tapestry5.modules.TapestryModule$2.service(TapestryModule.java:834)

   - org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:89)

   - org.company.tapdemo.services.AppModule$1.service(AppModule.java:101)
   - org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)

   - org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)

   - org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)

   - org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)

   - org.apache.tapestry5.modules.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:250)

   - org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)

   - org.company.tapdemo.services.impl.AjaxUploadServletRequestFilter.service(AjaxUploadServletRequestFilter.java:31)

   - org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)

   - org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)

   - org.apache.tapestry5.modules.TapestryModule$1.service(TapestryModule.java:794)

   - org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:166)

RequestContext Path/TapDemoPath/selectdemo.computer:changeLocaleen_USServer
NamelocalhostFlagsXHRPorts (local/server)8080 / 8080MethodPOSTQuery
Parameterst:formcomponentidSelectDemo:formt:formidformt:selectvalue2t:zoneid
ajaxZoneHeadersAccept*/*Accept-Encodinggzip, deflateAccept-Language
en-US,en;q=0.5Cache-Controlno-cacheConnectionkeep-aliveContent-Length91
Content-Typeapplication/x-www-form-urlencoded; charset=UTF-8Cookie
JSESSIONID=8zhf85bxcr15DNT1Hostlocalhost:8080Pragmano-cache
Proxy-AuthorizationBasic Z21jMDc6RmFsbGluZzIwMTM=Referer
http://localhost:8080/TapDemo/selectdemoUser-AgentMozilla/5.0 (Windows NT
6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0X-Requested-With
XMLHttpRequestAttributespage-nameSelectDemoservletAPI.characterEncodingUTF-8
servletAPI.contentLength91servletAPI.contentTypeapplication/x-www-form-urlencoded;
charset=UTF-8servletAPI.protocolHTTP/1.1servletAPI.schemehttp
tapestry.active-page-loadedtrueContext Attributes
com.sun.jsp.tagFileJarUrlsCache{}com.sun.jsp.taglibraryCache{}
javax.servlet.context.tempdir
C:\Users\gmc07\Documents\NetBeansProjects\TapDemo\target\work
org.apache.tapestry5.application-registry
org.apache.tapestry5.ioc.internal.RegistryWrapper@3fc70554


On Wed, Oct 16, 2013 at 8:43 AM, Lance Java <la...@googlemail.com>wrote:

> Can you post a stack trace?
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: T5.4 ajax select menu bug

Posted by Lance Java <la...@googlemail.com>.
Can you post a stack trace?

Re: T5.4 ajax select menu bug

Posted by Bob Harner <bo...@gmail.com>.
You can either persist your SelectModel, or recreate it in your
onPrepareForSubmit method (or in onPrepare, which gets called both for form
render and submit.

Yes, please create a JIRA issue.
On Oct 16, 2013 8:34 AM, "George Christman" <gc...@cardaddy.com> wrote:

> Thanks Bob for correcting the subject line to 5.4, I forget T4 actually
> existed.
>
> Unless there is another work around, I was unable to get this to work
> without the use of @Persist. Hopefully this is just a regression bug that
> can be resolved. Should this be reported?
>
>
> On Wed, Oct 16, 2013 at 7:01 AM, Bob Harner <bo...@gmail.com> wrote:
>
> > I noticed a couple of days ago in 5.4 alpha 22 that the SelectModel is
> now
> > being used on form render AND submission whereas it used to be used only
> on
> > render of the form. This is a big deal performance-wise because creation
> of
> > the SelectModel commonly involves a database query to populated a list of
> > objects.
> >
> > I haven't yet spent the time to look at this closely to see if I am doing
> > something wrong, but it looks like a regression to me.
> > On Oct 15, 2013 11:33 PM, "George Christman" <gc...@cardaddy.com>
> > wrote:
> >
> > > Some additional information, this appears to last work correctly in
> > version
> > > 5.4-alpha-20, but becomes broken in 5.4-alpha-21 - current.
> > >
> > >
> > > On Tue, Oct 15, 2013 at 11:09 PM, George Christman
> > > <gc...@cardaddy.com>wrote:
> > >
> > > > Hello, I have a year, make, model select menu in my application. I
> set
> > > the
> > > > model of the current menu based on the previous select menu using the
> > > > onValueChanged event and ajax zone component.  The select menu in
> > T.4.22
> > > > appears to be calling the SelectModel before it calls the
> > onValueChanged
> > > > event resulting in the following exception.
> > > >
> > > > org.apache.tapestry5.ioc.internal.util.TapestryException
> > > >
> > > > *Parameter 'model' of component Test:carmake is bound to null. This
> > > > parameter is not allowed to be null.*
> > > > locationclasspath:org/company/tapdemo/pages/Test.tml, line 9
> > > >
> > > > I used Geoff's example from jumpstart found below as a test to find
> the
> > > > same issue still existed in 4.22. I tried the example in 3.7 and
> didn't
> > > > experience any issues. Should I file a bug?
> > > >
> > > >
> > >
> >
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/selectmore1
> > > >
> > > >
> > > >
> > > > --
> > > > George Christman
> > > > www.CarDaddy.com
> > > > P.O. Box 735
> > > > Johnstown, New York
> > > >
> > > >
> > >
> > >
> > > --
> > > George Christman
> > > www.CarDaddy.com
> > > P.O. Box 735
> > > Johnstown, New York
> > >
> >
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>

Re: T5.4 ajax select menu bug

Posted by George Christman <gc...@cardaddy.com>.
Thanks Bob for correcting the subject line to 5.4, I forget T4 actually
existed.

Unless there is another work around, I was unable to get this to work
without the use of @Persist. Hopefully this is just a regression bug that
can be resolved. Should this be reported?


On Wed, Oct 16, 2013 at 7:01 AM, Bob Harner <bo...@gmail.com> wrote:

> I noticed a couple of days ago in 5.4 alpha 22 that the SelectModel is now
> being used on form render AND submission whereas it used to be used only on
> render of the form. This is a big deal performance-wise because creation of
> the SelectModel commonly involves a database query to populated a list of
> objects.
>
> I haven't yet spent the time to look at this closely to see if I am doing
> something wrong, but it looks like a regression to me.
> On Oct 15, 2013 11:33 PM, "George Christman" <gc...@cardaddy.com>
> wrote:
>
> > Some additional information, this appears to last work correctly in
> version
> > 5.4-alpha-20, but becomes broken in 5.4-alpha-21 - current.
> >
> >
> > On Tue, Oct 15, 2013 at 11:09 PM, George Christman
> > <gc...@cardaddy.com>wrote:
> >
> > > Hello, I have a year, make, model select menu in my application. I set
> > the
> > > model of the current menu based on the previous select menu using the
> > > onValueChanged event and ajax zone component.  The select menu in
> T.4.22
> > > appears to be calling the SelectModel before it calls the
> onValueChanged
> > > event resulting in the following exception.
> > >
> > > org.apache.tapestry5.ioc.internal.util.TapestryException
> > >
> > > *Parameter 'model' of component Test:carmake is bound to null. This
> > > parameter is not allowed to be null.*
> > > locationclasspath:org/company/tapdemo/pages/Test.tml, line 9
> > >
> > > I used Geoff's example from jumpstart found below as a test to find the
> > > same issue still existed in 4.22. I tried the example in 3.7 and didn't
> > > experience any issues. Should I file a bug?
> > >
> > >
> >
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/selectmore1
> > >
> > >
> > >
> > > --
> > > George Christman
> > > www.CarDaddy.com
> > > P.O. Box 735
> > > Johnstown, New York
> > >
> > >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York