Pre-Question: where can documentation issues/corrections/additions be
sent?  Better to send to the dev-list?

 

 

I lost some time trying to work with the Script component and wanted to
offer some suggestions:

 

http://jakarta.apache.org/tapestry/tapestry/ComponentReference/Script.ht
ml says that the Script component requires either a "scriptPath" or
"scriptAsset" parameter.  I specified the scriptPath parameter, and got
an Exception thrown: "Either the scriptAsset or the scriptPath parameter
must be supplied, neither parameter was set."  This baffled me for a bit
until I noticed the example on the above page used "script", not
"scriptPath".

 

Also, the parameter documentation /and/ the example says that scriptPath
is classpath-based, but when I tried that I got a
DocumentParseException: "Unable to find resource
context:com/dynedge/[blah blah]/[blah].script".  That indicated the path
is actually context-based, and guessing that a relative path would be
relative to the page-specification file, I confirmed this and got the
page to render.

 

 

I was also confused about the fact that a component-body is allowed, but
a scriptPath/scriptAsset is required - I wasn't sure how it would be
handled when both exist.   Through trial-and-error, I verified that the
.script file's initialization section gets inserted right before the
closing body-tag, the .script file's body section gets inserted after
the beginning body-tag, and the actual body of the Script component (in
the html template file) gets inserted right at the component's position
in its template.  I think this would be helpful to explicitly point out,
as well as the fact that Tapestry components can be embedded in the
Script component's body, even if it's inside a JavaScript string (I
wasn't sure Tapestry would be able to parse:
document.getElementById("<span jwcid="@Insert"
value="ognl:'blah'"></span>"); because of the nested quotes.  [though
nested brackets doesn't work, of course: "if (5 < <span jwcid="@Insert"
value="ognl:10"></span>) {"])

 

 

 

Thanks,

Jim

Reply via email to