In fact, looking at the source code to Script.java, I'm not sure that a sciprtAsset isn't supposed to be a .script file, anyway. In any case, it is get a NullPointerException because the IScriptSource object is null when you specify a scriptAsset, but it calls source.getScript() with the path of the asset, but source is null.
--sam On 4/6/06, Sam Gendler <[EMAIL PROTECTED]> wrote: > This appears to be good advice - except that there seems to be a bug > in the Script component. When I use a scriptAsset, it always errors > out with a NullPointerException. > > # org.apache.tapestry.html.Script.getParsedScript(Script.java:135) > # org.apache.tapestry.html.Script.renderComponent(Script.java:149) > # $Script_245.renderComponent($Script_245.java) > # org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617) > # org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:92) > # org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617) > # org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434) > # org.apache.tapestry.form.FormSupportImpl.render(FormSupportImpl.java:487) > # org.apache.tapestry.form.Form.renderComponent(Form.java:250) > > Also, if I try to use binding 'scriptPath' as specified in the docs, > it complains that 'Either the scriptAsset or the scriptPath parameter > must be supplied, neither parameter was set.' If I change the > 'scriptPath' binding to 'script' it works correctly. > > Yes, I am using the latest released version. > > --sam > > > On 4/5/06, Andreas Andreou <[EMAIL PROTECTED]> wrote: > > Yep, i think this was added in 4.0.1 > > > > Ashton Hepburn wrote: > > > > >Using Tapestry4 you can use the Script component and specify the > > >scriptAsset > > >parameter instead of scriptpath: > > > > > >http://jakarta.apache.org/tapestry/tapestry/ComponentReference/Script.html > > > > > >On 4/5/06, Sam Gendler <[EMAIL PROTECTED]> wrote: > > > > > > > > >>I have to include a javascript file which must be located in my /js > > >>directory due to dependencies on relative file paths (turbo and dojo, > > >>if you must know). It appears that I can only include a resource in a > > >>.script file if it is in my classpath, and then it is included via > > >>some horribly complicated URL. > > >> > > >>Is there some way that I can just inject a <script > > >>language="JavaScript" type="text/javascript" > > >>src="${scriptPath}></script> line via a .script file, preferably into > > >>the head? I've been struggling for a good long while, and I have yet > > >>to figure it out. I should point out that I am not much of a > > >>javascript code. There is probably some javascript function I could > > >>write that would modify the head element by adding a new script > > >>element to it, but I don't know how to write it, offhand, and I'm too > > >>frazzled by a long day to try to figure it out. So I turn to the > > >>collective wisom in desperation. > > >> > > >>Thanks > > >> > > >>--sam > > >> > > >>--------------------------------------------------------------------- > > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > > >>For additional commands, e-mail: [EMAIL PROTECTED] > > >> > > >> > > >> > > >> > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]