You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "F. Da Costa" <da...@xs4all.nl> on 2004/01/03 19:34:07 UTC
[Script] relation of .script to the other files
Hi,
Are my folowing assumptions re. Script tag usage correct?
1. <input-symbol key="toJavaClassID" class="full.path.Xyz"> basically
'links' to the .java file similar to the <component id="ID"
class="full.path.Xyz"> and <page id="ID" class="full.path.Xyz"> specifications.
2. Assuming 1 I can use several classes at the same time in 1 Script.
3. <input-symbol key="someKey" class="full.type.Class"> basically acts as a
parameter to a .page or .jwc file similar to the parameter definitions in
the .jwc and .page files.
4. <set key="xyz" expression="tojavaClassID.x.y.z"> could be looked upon as
a binding in a .page/ .jwc sense. With the exception of it being embedded
within a component
Just trying to a handle on the Script thing because I've got this funny
feeling that it's also quite power- and usefull.
TIA
Fermin DCG
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: [Script] relation of .script to the other files (hmm)
Posted by "F. Da Costa" <da...@xs4all.nl>.
Harish Krishnaswamy wrote:
> <input-symbol> to .script is what a <parameter> is to .page/.jwc except
> the direction is always "in". Perhaps the class attribute should have
> been named "type" similar to <parameter>.
Ok, i guess.
> If you mean several <input-symbols>, then yes.
Noop this is not what I meant but I do understand what y'r saying
>
>
> Yes, as far as I know ;)
Ok, in that case I'm not getting it as far as the 1. part is concerned.
Maybe its better to explain what I'm trying to accomplish (and failing in
accomplishing).
Following a snip of a .page that works up to the script part.
<page-specification class="Home">
<description>This is the Home.page spec file</description>
<component id="rows" type="Foreach">
<static-binding name="element">tr</static-binding>
<binding name="source" expression="rows" />
<binding name="value" expression="row" />
</component>
<component id="cells" type="Foreach">
<binding name="source" expression="dataCells"/>
<binding name="value" expression="dataCell"/>
</component>
<component id="script" type="Script">
<static-binding name="script">test1.script</static-binding>
<!--binding name="row" expression="components.rows.value" />
<binding name="cell" expression="components.cells.value" /-->
<binding name="test" expression="test" />
</component>
</page-specification>
The .html looks as follows and works as well
<span jwcid="@Script" script="test1.script" />
<div id="doc">
<h3>Hello this is the MAIN div</h3>
<table id="t0">
<tr jwcid="rows">
<span jwcid="cells">
<td><span jwcid="@Insert" value="ognl:dataCell">numeric value</span></td>
</span>
</tr>
</table>
</div>
What I'm trying to do is *add* a couple of rows to the div (or the table
for that matter) by creating JS entries for using the DOM model.
The following code succeeds in adding a table to the bottom of the code in
the div.
What I am looking for is a way to take the data that normally 'flows'
through the .page into the .html and let that pass through the script instead.
This means that one can create DOM subsections and shoot that into the page
without having to re-render the whole thing (or am I making a big
misstake now?). This could prove esp usefull in large structures one would
like to load 'lazely'
<script>
<!--input-symbol key="table" class="Home">
<set key="row" expression="java.lang.String" required="yes"/>
<input-symbol key="cell" class="java.lang.String" required="yes"/-->
<input-symbol key="test" class="java.lang.String" required="no"/>
<body>
<![CDATA[
function start() {
// get the reference for the body
//var mybody=document.getElementsByTagName("body").item(0);
mybody=document.getElementById("doc");
// creates an element whose tag name is TABLE
mytable = document.createElement("TABLE");
// creates an element whose tag name is TBODY
mytablebody = document.createElement("TBODY");
// creating all cells
for(j=0;j<2;j++) {
// creates an element whose tag name is TR
mycurrent_row=document.createElement("TR");
for(i=0;i<2;i++) {
// creates an element whose tag name is TD
mycurrent_cell=document.createElement("TD");
// creates a Text Node
*currenttext=document.createTextNode("cell is row "+j+", column "+i);*
//currenttext=document.createTextNode(${test});
// appends the Text Node we created into the cell TD
mycurrent_cell.appendChild(currenttext);
// appends the cell TD into the row TR
mycurrent_row.appendChild(mycurrent_cell);
}
// appends the row TR into TBODY
mytablebody.appendChild(mycurrent_row);
}
// appends TBODY into TABLE
mytable.appendChild(mytablebody);
// appends TABLE into BODY
mybody.appendChild(mytable);
// sets the border attribute of mytable to 2;
mytable.setAttribute("border","2");
}
]]>
</body>
<initialization>
start();
</initialization>
</script>
Any suggestion would be welcomed.
TIA
Fermin DCG
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: [Script] relation of .script to the other files
Posted by Harish Krishnaswamy <hk...@comcast.net>.
F. Da Costa wrote:
> Hi,
>
> Are my folowing assumptions re. Script tag usage correct?
>
> 1. <input-symbol key="toJavaClassID" class="full.path.Xyz"> basically
> 'links' to the .java file similar to the <component id="ID"
> class="full.path.Xyz"> and <page id="ID" class="full.path.Xyz">
> specifications.
<input-symbol> to .script is what a <parameter> is to .page/.jwc except the direction is always
"in". Perhaps the class attribute should have been named "type" similar to <parameter>.
>
> 2. Assuming 1 I can use several classes at the same time in 1 Script.
If you mean several <input-symbols>, then yes.
>
> 3. <input-symbol key="someKey" class="full.type.Class"> basically acts
> as a parameter to a .page or .jwc file similar to the parameter
> definitions in the .jwc and .page files.
Yes.
>
> 4. <set key="xyz" expression="tojavaClassID.x.y.z"> could be looked upon
> as a binding in a .page/ .jwc sense. With the exception of it being
> embedded within a component
Yes, as far as I know ;)
>
> Just trying to a handle on the Script thing because I've got this funny
> feeling that it's also quite power- and usefull.
>
> TIA
> Fermin DCG
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org