You're correct in all. If a refreshed component does produce js, we must include and execute it.
Otherwise, we wouldn't be able to show components (that didn't previously exist) that result from an ajax request. If you don't like this, there's a way to disable executing script after an ajax response. Indeed AjaxDirectServiceParameter ( from http://tacos.sourceforge.net/api/net/sf/tacos/ajax/AjaxDirectServiceParameter.html ) has a processScripts boolean parameter... i've never used that + don't know how you can control this from a component... Do you really need this? On the other hand, if you want to use the new definitions of your functions, you must indeed scope them correctly. Instead of var ${blah} = new Blah(); use document.${blah} = new Blah(); Karthik N wrote: > We have initializion javascript code in our .script file like this: > > > <initialization> > var ${blah} = new Blah(); > </initialization> > > > Also in our HTML we have a way to connect to ${blah}. I've left those > details out for simplicity. > > At the end of the day the HTML snippets in the browser are like: > > <a href="#" onclick="blah.foo()"/> > > <script> > var blah = new Blah(); > </script> > > The situation: > All good so far, now we do a Tacos Submit. > > What we find is that the Tacos response causes the <initialization> > code to happen again. Hence, > var blah = new Blah(); > > happens again. > > So first question is: > > 1. Why does Tacos do an initialization again? > > Now what's even more interesting is that even though > var blah = new Blah(); > happens again, we observe that the > > <a href="#" onclick=" blah.foo()"/> > > still points to the instance of blah that got created on THE FIRST > page load !! > > We strongly suspect that this might be because the initialization > happening in Tacos subsequently > is an eval() of a function and hence the second time: > > var blah = new Blah(); > > has blah scoped in the function, and hence doesn't affect the <a > href="#" onclick="blah.foo()"/> > > So our second question > > 2. Is our hypothesis of this eval() and scoping correct?? > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ------------------------------------------------------------------------ > > _______________________________________________ > Tacos-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tacos-devel > -- Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr Tapestry / Tacos developer Open Source / J2EE Consulting ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Tacos-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tacos-devel
