Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2204

Select component fails if SelectModel doesn't exist on submit

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.4
    • Fix Version/s: 5.4
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      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.

      This appears to be a regression bug starting in 5.4.21.

      Nabble post

      http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Re-T5-4-ajax-select-menu-bug-td5724142.html

      Sample code and stack trace.

      Geoff example

      http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/selectmore1

      or

      <html t:type="layout" t:title="Select Demo" xmlns:t="
      http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
      xmlns="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 onValueChangedFromComputer(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="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

        Attachments

          Activity

            People

            • Assignee:
              jkemnade Jochen Kemnade
              Reporter:
              gchristman George Christman
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: