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.R. Da Costa Gomez" <dc...@fixed.com> on 2003/04/28 12:55:06 UTC

Javascript: How to send value to server

Hi all,

I was wondering whether someone could help me with the following:
On a page I can get a uuid by means of the statement: 
tree.getSelected().UUID
I need to get this uuid to the server in order to retrieve the object in 
question to do 'stuff' with it.

I am assuming it is rather simple but for now I have not been able to 
figure it out.
If someone could put me in the right direction it would be much appreciated.

TIA,
Fermin DCG


Re: Javascript: How to send value to server

Posted by "F.R. Da Costa Gomez" <dc...@fixed.com>.
These 'things' seem to translate into name="xyz" (except for the 
addForm, see Howards reply on *xzy@Form ...*).
This way one can refer back to the component/ property of the object and 
use it. For example in a JS, as can be seen below.
The line *document.addForm.testUUID.value = uuid;* gets a handle on the 
@Hidden component by referring to the testUUID. If there is also another 
way I'm reading (/listening).

This is my understanding (for the moment), if I am not totally correct I 
hope to be corrected.

Cheers,

Fermin DCG

Christian Sell wrote:

> erm, just a quick question: what is it about these jwcids 
> "addForm@Form" and  "testUUID@Hidden"? Until now all I have seen is 
> jwcids like "@Form" (and, of course, ids backed by an explicit 
> definition in the page spec).
>
> thanks,
> Christian
>
>
> F.R. Da Costa Gomez wrote:
>
>> Thx 4 the reply.
>> It seems however that there is a much easier solution:
>>
>> <form jwcid="addForm@Form">
>>    <input jwcid="testUUID@Hidden" value="ognl:UUID" type="hidden" />
>> </form>
>> <input type="button" onclick="addNode();" value="Add Node"/>
>>
>> function addNode() {
>>    if tree.getSelected() {
>>       var uuid = tree.getSelected().UUID;
>>       document.addForm.testUUID.value = uuid;
>>    }
>> }
>>
>> public void setUUID(String value) {
>> ...
>> }
>> public String getUUID() {
>> return String;
>> }
>



RE: Javascript: How to send value to server

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
You are allowed to specify a specific jwcid for implicit components; so
"addForm@Form" is the same as <component id="addForm" type="Form">.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Christian Sell [mailto:christian.sell@netcologne.de] 
> Sent: Tuesday, April 29, 2003 3:35 PM
> To: Tapestry users
> Subject: Re: Javascript: How to send value to server
> 
> 
> erm, just a quick question: what is it about these jwcids 
> "addForm@Form" 
> and  "testUUID@Hidden"? Until now all I have seen is jwcids 
> like "@Form" 
> (and, of course, ids backed by an explicit definition in the 
> page spec).
> 
> thanks,
> Christian
> 
> 
> F.R. Da Costa Gomez wrote:
> > Thx 4 the reply.
> > It seems however that there is a much easier solution:
> > 
> > <form jwcid="addForm@Form">
> >    <input jwcid="testUUID@Hidden" value="ognl:UUID" 
> type="hidden" /> 
> > </form> <input type="button" onclick="addNode();" value="Add Node"/>
> > 
> > function addNode() {
> >    if tree.getSelected() {
> >       var uuid = tree.getSelected().UUID;
> >       document.addForm.testUUID.value = uuid;
> >    }
> > }
> > 
> > public void setUUID(String value) {
> > ...
> > }
> > public String getUUID() {
> > return String;
> > }
> > 
> > 
> > Using the above structure allows me to set the testUUID value to its
> > required value via the JS.
> > This basically allows me to produce anything and send it 
> for use to the 
> > server.
> > On onclick the testUUID.value field is filled in addNode() and 
> > subsequently 'shot' to the server. Works like a charm.
> > Presto, I've now got the uuid on the server -> retrieve the proper 
> > object from the db -> render it back to the client.
> > Nice and clean with low overhead. :-)
> > 
> > I suppose I need to seriously brush up on my explanations 
> now, because
> > this solution really is too simple. :-D
> > 
> > Cheers
> > Fermin DCG
> > 
> > simon.robins wrote:
> > 
> >> Now I understand.
> >>
> >> the HTML generated for each node in the Tree could be 
> something like
> >> this:
> >>
> >> <A HREF="#" OnClick="TreeNodeSubmit()">Some Text</A>
> >>
> >> the Javascript like this:
> >>
> >> function TreeNodeSubmit()
> >> {
> >>     var UUID = tree.getSelected().UUID
> >>
> >>     document.location.href = "${treeNodeURL}&sp="+UUID
> >> }
> >>
> >> The missing bit is a java method that generates the 
> treeNodeURL which
> >> you pass through to the javascript .script file as a parameter.
> >>
> >> To do this you need to call one of the Tapestry link services 
> >> (Direct,
> >> Action, External).
> >> For example:
> >>
> >>     public String getTreeNodeURL()
> >>     {
> >>         IEngineService directService =
> >> 
> getRequestCycle().getEngine().getService(Tapestry.EXTERNAL_SERVICE);
> >>         ILink link = directService.getLink(cycle, null, 
> new Object[]{ 
> >> "<some page name>"});
> >>         return link.getURL();
> >>     }
> >>
> >> Hopefully this will get you started.
> >>
> >> Cheers,
> > 
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > 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
> 


Re: Javascript: How to send value to server

Posted by "simon.robins" <si...@mac.com>.
It's how you reference anonymous components from other components.

For example:

<foreach jwcid="loop@Foreach" source="ognl:objects">
	<insert jwcid="@Insert" value="ognl:components.loop.value"/>
</foreach>

On Tuesday, April 29, 2003, at 08:34  pm, Christian Sell wrote:

> erm, just a quick question: what is it about these jwcids 
> "addForm@Form" and  "testUUID@Hidden"? Until now all I have seen is 
> jwcids like "@Form" (and, of course, ids backed by an explicit 
> definition in the page spec).
>
> thanks,
> Christian
>
>
> F.R. Da Costa Gomez wrote:
>> Thx 4 the reply.
>> It seems however that there is a much easier solution:
>> <form jwcid="addForm@Form">
>>    <input jwcid="testUUID@Hidden" value="ognl:UUID" type="hidden" />
>> </form>
>> <input type="button" onclick="addNode();" value="Add Node"/>
>> function addNode() {
>>    if tree.getSelected() {
>>       var uuid = tree.getSelected().UUID;
>>       document.addForm.testUUID.value = uuid;
>>    }
>> }
>> public void setUUID(String value) {
>> ...
>> }
>> public String getUUID() {
>> return String;
>> }
>> Using the above structure allows me to set the testUUID value to its 
>> required value via the JS.
>> This basically allows me to produce anything and send it for use to 
>> the server.
>> On onclick the testUUID.value field is filled in addNode() and 
>> subsequently 'shot' to the server. Works like a charm.
>> Presto, I've now got the uuid on the server -> retrieve the proper 
>> object from the db -> render it back to the client.
>> Nice and clean with low overhead. :-)
>> I suppose I need to seriously brush up on my explanations now, 
>> because this solution really is too simple. :-D
>> Cheers
>> Fermin DCG
>> simon.robins wrote:
>>> Now I understand.
>>>
>>> the HTML generated for each node in the Tree could be something like 
>>> this:
>>>
>>> <A HREF="#" OnClick="TreeNodeSubmit()">Some Text</A>
>>>
>>> the Javascript like this:
>>>
>>> function TreeNodeSubmit()
>>> {
>>>     var UUID = tree.getSelected().UUID
>>>
>>>     document.location.href = "${treeNodeURL}&sp="+UUID
>>> }
>>>
>>> The missing bit is a java method that generates the treeNodeURL 
>>> which you pass through to the javascript .script file as a >>> parameter.
>>>
>>> To do this you need to call one of the Tapestry link services 
>>> (Direct, Action, External).
>>> For example:
>>>
>>>     public String getTreeNodeURL()
>>>     {
>>>         IEngineService directService = 
>>> getRequestCycle().getEngine().getService(Tapestry.EXTERNAL_SERVICE);
>>>         ILink link = directService.getLink(cycle, null, new 
>>> Object[]{ "<some page name>"});
>>>         return link.getURL();
>>>     }
>>>
>>> Hopefully this will get you started.
>>>
>>> Cheers,
>> ---------------------------------------------------------------------
>> 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
>


Re: Javascript: How to send value to server

Posted by Christian Sell <ch...@netcologne.de>.
erm, just a quick question: what is it about these jwcids "addForm@Form" 
and  "testUUID@Hidden"? Until now all I have seen is jwcids like "@Form" 
(and, of course, ids backed by an explicit definition in the page spec).

thanks,
Christian


F.R. Da Costa Gomez wrote:
> Thx 4 the reply.
> It seems however that there is a much easier solution:
> 
> <form jwcid="addForm@Form">
>    <input jwcid="testUUID@Hidden" value="ognl:UUID" type="hidden" />
> </form>
> <input type="button" onclick="addNode();" value="Add Node"/>
> 
> function addNode() {
>    if tree.getSelected() {
>       var uuid = tree.getSelected().UUID;
>       document.addForm.testUUID.value = uuid;
>    }
> }
> 
> public void setUUID(String value) {
> ...
> }
> public String getUUID() {
> return String;
> }
> 
> 
> Using the above structure allows me to set the testUUID value to its 
> required value via the JS.
> This basically allows me to produce anything and send it for use to the 
> server.
> On onclick the testUUID.value field is filled in addNode() and 
> subsequently 'shot' to the server. Works like a charm.
> Presto, I've now got the uuid on the server -> retrieve the proper 
> object from the db -> render it back to the client.
> Nice and clean with low overhead. :-)
> 
> I suppose I need to seriously brush up on my explanations now, because 
> this solution really is too simple. :-D
> 
> Cheers
> Fermin DCG
> 
> simon.robins wrote:
> 
>> Now I understand.
>>
>> the HTML generated for each node in the Tree could be something like 
>> this:
>>
>> <A HREF="#" OnClick="TreeNodeSubmit()">Some Text</A>
>>
>> the Javascript like this:
>>
>> function TreeNodeSubmit()
>> {
>>     var UUID = tree.getSelected().UUID
>>
>>     document.location.href = "${treeNodeURL}&sp="+UUID
>> }
>>
>> The missing bit is a java method that generates the treeNodeURL which 
>> you pass through to the javascript .script file as a parameter.
>>
>> To do this you need to call one of the Tapestry link services (Direct, 
>> Action, External).
>> For example:
>>
>>     public String getTreeNodeURL()
>>     {
>>         IEngineService directService = 
>> getRequestCycle().getEngine().getService(Tapestry.EXTERNAL_SERVICE);
>>         ILink link = directService.getLink(cycle, null, new Object[]{ 
>> "<some page name>"});
>>         return link.getURL();
>>     }
>>
>> Hopefully this will get you started.
>>
>> Cheers,
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



Re: Javascript: How to send value to server

Posted by "F. Da Costa Gomez" <dc...@fixed.com>.
Thx a mill for the idea.
I'm nor sure whether the following was what you meant but this is how I 
implemented it
<a href="#" name="addChoice" onclick="this.href=this.href+'&sp='+ 
tree.getSelected().UUID;" jwcid="@DirectLink" 
listener="ognl:listeners.choiceActionListener" parameters="new" >Add 
category</a>

As you can see I utilised your suggestion but in a slightly different 
manner. I couldn't get to the href of the link from a seperate 
js-function (if there is a way I would rather use that though).
Granted I have to copy the code a couple of times but after a couple of 
days of struggling I am :-)        to be able to continue.

Thx again,
Cheers,
Fermin


simon.robins wrote:

> document.location.href = "${URL}&sp=new&sp=" + tree.getSelected().UUID
>
> ${URL} is passed to the javascript via a parameter
>
> If you check out ExternalService it show how urls are constructed.
>
> Your method is perfectly valid. I just prefer this way when a form 
> isn't neccessary as it's slightly more effecient. (No rewind required).
>
> On Wednesday, April 30, 2003, at 01:33  pm, F.R. Da Costa Gomez wrote:
>
>> Hmm, fair enough but how would you fill the parameters="" attibute of 
>> the @DirectLink with the values "new' and "uuid"?
>> The "new" is known but the uuid (as you would guess) will be 
>> determined by selection of the user and obtained via JS.
>> In the JS function I can create a new Array(2) and fill [0] and [1] 
>> with resp."new" and tree.getSelected().UUID but how do you send this 
>> structure to the server if the parameters attribute does NOT appear 
>> to exist in the rendered page.
>>
>> Note that the parameters can only be filled from the client.
>>
>> Cheers,
>> Fermin
>>
>> simon.robins wrote:
>>
>>> Horses for courses.
>>>
>>> I tend to use Direct or External link for this sort of stuff as 
>>> forms need a rewind phase.
>>>
>>> On Tuesday, April 29, 2003, at 04:34  pm, F.R. Da Costa Gomez wrote:
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>



Re: Javascript: How to send value to server

Posted by "simon.robins" <si...@mac.com>.
document.location.href = "${URL}&sp=new&sp=" + tree.getSelected().UUID

${URL} is passed to the javascript via a parameter

If you check out ExternalService it show how urls are constructed.

Your method is perfectly valid. I just prefer this way when a form 
isn't neccessary as it's slightly more effecient. (No rewind required).

On Wednesday, April 30, 2003, at 01:33  pm, F.R. Da Costa Gomez wrote:

> Hmm, fair enough but how would you fill the parameters="" attibute of 
> the @DirectLink with the values "new' and "uuid"?
> The "new" is known but the uuid (as you would guess) will be 
> determined by selection of the user and obtained via JS.
> In the JS function I can create a new Array(2) and fill [0] and [1] 
> with resp."new" and tree.getSelected().UUID but how do you send this 
> structure to the server if the parameters attribute does NOT appear to 
> exist in the rendered page.
>
> Note that the parameters can only be filled from the client.
>
> Cheers,
> Fermin
>
> simon.robins wrote:
>
>> Horses for courses.
>>
>> I tend to use Direct or External link for this sort of stuff as forms 
>> need a rewind phase.
>>
>> On Tuesday, April 29, 2003, at 04:34  pm, F.R. Da Costa Gomez wrote:


Re: Javascript: How to send value to server

Posted by "F.R. Da Costa Gomez" <dc...@fixed.com>.
Hmm, fair enough but how would you fill the parameters="" attibute of 
the @DirectLink with the values "new' and "uuid"?
The "new" is known but the uuid (as you would guess) will be determined 
by selection of the user and obtained via JS.
In the JS function I can create a new Array(2) and fill [0] and [1] with 
resp."new" and tree.getSelected().UUID but how do you send this 
structure to the server if the parameters attribute does NOT appear to 
exist in the rendered page.

Note that the parameters can only be filled from the client.

Cheers,
Fermin

simon.robins wrote:

> Horses for courses.
>
> I tend to use Direct or External link for this sort of stuff as forms 
> need a rewind phase.
>
> On Tuesday, April 29, 2003, at 04:34  pm, F.R. Da Costa Gomez wrote:
>
>> Thx 4 the reply.
>> It seems however that there is a much easier solution:
>>
>> <form jwcid="addForm@Form">
>>    <input jwcid="testUUID@Hidden" value="ognl:UUID" type="hidden" />
>> </form>
>> <input type="button" onclick="addNode();" value="Add Node"/>
>>
>> function addNode() {
>>    if tree.getSelected() {
>>       var uuid = tree.getSelected().UUID;
>>       document.addForm.testUUID.value = uuid;
>>    }
>> }
>>
>> public void setUUID(String value) {
>> ...
>> }
>> public String getUUID() {
>> return String;
>> }
>



Re: Javascript: How to send value to server

Posted by "simon.robins" <si...@mac.com>.
Horses for courses.

I tend to use Direct or External link for this sort of stuff as forms 
need a rewind phase.

On Tuesday, April 29, 2003, at 04:34  pm, F.R. Da Costa Gomez wrote:

> Thx 4 the reply.
> It seems however that there is a much easier solution:
>
> <form jwcid="addForm@Form">
>    <input jwcid="testUUID@Hidden" value="ognl:UUID" type="hidden" />
> </form>
> <input type="button" onclick="addNode();" value="Add Node"/>
>
> function addNode() {
>    if tree.getSelected() {
>       var uuid = tree.getSelected().UUID;
>       document.addForm.testUUID.value = uuid;
>    }
> }
>
> public void setUUID(String value) {
> ...
> }
> public String getUUID() {
> return String;
> }
>
>
> Using the above structure allows me to set the testUUID value to its 
> required value via the JS.
> This basically allows me to produce anything and send it for use to 
> the server.
> On onclick the testUUID.value field is filled in addNode() and 
> subsequently 'shot' to the server. Works like a charm.
> Presto, I've now got the uuid on the server -> retrieve the proper 
> object from the db -> render it back to the client.
> Nice and clean with low overhead. :-)
>
> I suppose I need to seriously brush up on my explanations now, because 
> this solution really is too simple. :-D
>
> Cheers
> Fermin DCG
>
> simon.robins wrote:
>
>> Now I understand.
>>
>> the HTML generated for each node in the Tree could be something like 
>> this:
>>
>> <A HREF="#" OnClick="TreeNodeSubmit()">Some Text</A>
>>
>> the Javascript like this:
>>
>> function TreeNodeSubmit()
>> {
>>     var UUID = tree.getSelected().UUID
>>
>>     document.location.href = "${treeNodeURL}&sp="+UUID
>> }
>>
>> The missing bit is a java method that generates the treeNodeURL which 
>> you pass through to the javascript .script file as a parameter.
>>
>> To do this you need to call one of the Tapestry link services 
>> (Direct, Action, External).
>> For example:
>>
>>     public String getTreeNodeURL()
>>     {
>>         IEngineService directService = 
>> getRequestCycle().getEngine().getService(Tapestry.EXTERNAL_SERVICE);
>>         ILink link = directService.getLink(cycle, null, new Object[]{ 
>> "<some page name>"});
>>         return link.getURL();
>>     }
>>
>> Hopefully this will get you started.
>>
>> Cheers,
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Re: Javascript: How to send value to server

Posted by "F.R. Da Costa Gomez" <dc...@fixed.com>.
Thx 4 the reply.
It seems however that there is a much easier solution:

<form jwcid="addForm@Form">
    <input jwcid="testUUID@Hidden" value="ognl:UUID" type="hidden" />
</form>
<input type="button" onclick="addNode();" value="Add Node"/>

function addNode() {
    if tree.getSelected() {
       var uuid = tree.getSelected().UUID;
       document.addForm.testUUID.value = uuid;
    }
}

public void setUUID(String value) {
...
}
public String getUUID() {
return String;
}


Using the above structure allows me to set the testUUID value to its 
required value via the JS.
This basically allows me to produce anything and send it for use to the 
server.
On onclick the testUUID.value field is filled in addNode() and 
subsequently 'shot' to the server. Works like a charm.
Presto, I've now got the uuid on the server -> retrieve the proper 
object from the db -> render it back to the client.
Nice and clean with low overhead. :-)

I suppose I need to seriously brush up on my explanations now, because 
this solution really is too simple. :-D

Cheers
Fermin DCG

simon.robins wrote:

> Now I understand.
>
> the HTML generated for each node in the Tree could be something like 
> this:
>
> <A HREF="#" OnClick="TreeNodeSubmit()">Some Text</A>
>
> the Javascript like this:
>
> function TreeNodeSubmit()
> {
>     var UUID = tree.getSelected().UUID
>
>     document.location.href = "${treeNodeURL}&sp="+UUID
> }
>
> The missing bit is a java method that generates the treeNodeURL which 
> you pass through to the javascript .script file as a parameter.
>
> To do this you need to call one of the Tapestry link services (Direct, 
> Action, External).
> For example:
>
>     public String getTreeNodeURL()
>     {
>         IEngineService directService = 
> getRequestCycle().getEngine().getService(Tapestry.EXTERNAL_SERVICE);
>         ILink link = directService.getLink(cycle, null, new Object[]{ 
> "<some page name>"});
>         return link.getURL();
>     }
>
> Hopefully this will get you started.
>
> Cheers,




Re: Javascript: How to send value to server

Posted by "simon.robins" <si...@mac.com>.
Now I understand.

the HTML generated for each node in the Tree could be something like 
this:

<A HREF="#" OnClick="TreeNodeSubmit()">Some Text</A>

the Javascript like this:

function TreeNodeSubmit()
{
	var UUID = tree.getSelected().UUID

	document.location.href = "${treeNodeURL}&sp="+UUID
}

The missing bit is a java method that generates the treeNodeURL which 
you pass through to the javascript .script file as a parameter.

To do this you need to call one of the Tapestry link services (Direct, 
Action, External).
For example:

	public String getTreeNodeURL()
	{
		IEngineService directService = 
getRequestCycle().getEngine().getService(Tapestry.EXTERNAL_SERVICE);
		ILink link = directService.getLink(cycle, null, new Object[]{ "<some 
page name>"});
		return link.getURL();
	}

Hopefully this will get you started.

Cheers,

Simon

On Monday, April 28, 2003, at 05:10  pm, F.R. Da Costa Gomez wrote:

> Being emerged deeply in putting together a piece of SW one sometimes 
> tends to forget others are not (I know I do).
> Obviously I should explain my question better.
>
> Situation:
> On the client-side a javascript tree is used which is build via the 
> proper Tapestry 'routine'. This works like a charm.
> Every node on the tree represents an object in a database (oodbms, 
> because it makes more sense using this than some convulted rdbms which 
> I have to squeeze into something artificial in order to work with it 
> as an object).
> Since there is no *direct coupling* between the tree and the object 
> structure (in the db) it represents, I use a proxy, being the uuid 
> (String) of the object within the database.
> Basically this allows me to have a simplified direct representative of 
> the db object on the client (without incurring any additional 
> overhead, I do not flood the client with stuff it doesn't need and I 
> can still say that the db structure for the tree is properly 
> represented).
> In short, every node in tree the cleint 'sees' is 'linked' by a uuid 
> string to a persistent object in the db (on the server). So, data 
> resides (lives) on the server and a representation thereof can be seen 
> on the client.
>
> Here is my question:
> When a client selects an arbitrary node on the tree one should 
> translate this as obtaining a handle on the db-object being 
> represented by the selected node.
> Since the node is 'equipped' with the uuid I figured it should  not be 
> to difficult to use this uuid-string to get the object from the > server.
> Using the javascipt function-call *tree.getSelected().UUID* I can get 
> the uuid belonging to the node. No worries.
> I only need to get this string to the server. Similar to <span 
> jwcid="abc@TextField" value="ognl:someProperty"> being used within a 
> @Form to get info from the user into someProperty.
> The only difference being that the user does not fill in a field on a 
> form, instead the value for this field would ideally have to be the 
> uuid (produced by the js function).
> In short, how do I get the result of the js-function to the server so 
> that I can retrieve the proper object. The easiest way seems to be 
> something comparable to the @TextField structure where the user-input 
> is substituted by the js-function result.
>
> I hope this is a better description of the situation at hand. If not 
> please lemme know.
> Looking at the various parts being utilised this thing could possibly 
> serve some decent educational purposes as well.
>
> Thx again,
> Fermin DCG
>
> Howard M. Lewis Ship wrote:
>
>> I believe Mr. Da Costa Gomez is having trouble because of a mix 
>> client-side
>> and server-side.  I believe his tree object may be a client side.
>>
>> The right approach is to start with a diagram of what data lives 
>> where and
>> how it has to move.  A verbal description should follow.  In his 
>> case, I
>> believe client-side javascript needs to trigger behaviors on the 
>> server
>> side; before he should attempt something like this in a Tapestry
>> application, he should be well grounded in client-side scripting, and 
>> be
>> capable of at least prototyping the interaction using static HTML.  My
>> JavaScript skills are limited, so we're nearing the end of how I can 
>> help.
>>
>> --
>> Howard M. Lewis Ship
>> Creator, Tapestry: Java Web Components
>> http://jakarta.apache.org/tapestry
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Re: Javascript: How to send value to server

Posted by "F.R. Da Costa Gomez" <dc...@fixed.com>.
Being emerged deeply in putting together a piece of SW one sometimes 
tends to forget others are not (I know I do).
Obviously I should explain my question better.

Situation:
On the client-side a javascript tree is used which is build via the 
proper Tapestry 'routine'. This works like a charm.
Every node on the tree represents an object in a database (oodbms, 
because it makes more sense using this than some convulted rdbms which I 
have to squeeze into something artificial in order to work with it as an 
object).
Since there is no *direct coupling* between the tree and the object 
structure (in the db) it represents, I use a proxy, being the uuid 
(String) of the object within the database.
Basically this allows me to have a simplified direct representative of 
the db object on the client (without incurring any additional overhead, 
I do not flood the client with stuff it doesn't need and I can still say 
that the db structure for the tree is properly represented).
In short, every node in tree the cleint 'sees' is 'linked' by a uuid 
string to a persistent object in the db (on the server). So, data 
resides (lives) on the server and a representation thereof can be seen 
on the client.

Here is my question:
When a client selects an arbitrary node on the tree one should translate 
this as obtaining a handle on the db-object being represented by the 
selected node.
Since the node is 'equipped' with the uuid I figured it should  not be 
to difficult to use this uuid-string to get the object from the server.
Using the javascipt function-call *tree.getSelected().UUID* I can get 
the uuid belonging to the node. No worries.
I only need to get this string to the server. Similar to <span 
jwcid="abc@TextField" value="ognl:someProperty"> being used within a 
@Form to get info from the user into someProperty.
The only difference being that the user does not fill in a field on a 
form, instead the value for this field would ideally have to be the uuid 
(produced by the js function).
In short, how do I get the result of the js-function to the server so 
that I can retrieve the proper object. The easiest way seems to be 
something comparable to the @TextField structure where the user-input is 
substituted by the js-function result.

I hope this is a better description of the situation at hand. If not 
please lemme know.
Looking at the various parts being utilised this thing could possibly 
serve some decent educational purposes as well.

Thx again,
Fermin DCG

Howard M. Lewis Ship wrote:

>I believe Mr. Da Costa Gomez is having trouble because of a mix client-side
>and server-side.  I believe his tree object may be a client side.
>
>The right approach is to start with a diagram of what data lives where and
>how it has to move.  A verbal description should follow.  In his case, I
>believe client-side javascript needs to trigger behaviors on the server
>side; before he should attempt something like this in a Tapestry
>application, he should be well grounded in client-side scripting, and be
>capable of at least prototyping the interaction using static HTML.  My
>JavaScript skills are limited, so we're nearing the end of how I can help.
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>  
>



RE: Javascript: How to send value to server

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
I believe Mr. Da Costa Gomez is having trouble because of a mix client-side
and server-side.  I believe his tree object may be a client side.

The right approach is to start with a diagram of what data lives where and
how it has to move.  A verbal description should follow.  In his case, I
believe client-side javascript needs to trigger behaviors on the server
side; before he should attempt something like this in a Tapestry
application, he should be well grounded in client-side scripting, and be
capable of at least prototyping the interaction using static HTML.  My
JavaScript skills are limited, so we're nearing the end of how I can help.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: simon.robins [mailto:simonrobins@mac.com] 
> Sent: Monday, April 28, 2003 9:59 AM
> To: Tapestry users
> Subject: Re: Javascript: How to send value to server
> 
> 
> Hi
> 
> This:
> 
> parameters="string:tree.getSelected().UUID"
> 
> should probably be this:
> 
> parameters="ognl:tree.selected.UUID"
> 
> assuming that there is an accessor getTree in the base class for this 
> page and a getSelected method in the class returned by getTree and a 
> getUUID method in the class returned by getSelected. Phew!
> 
> 'string:' gets localized strings out of the relevant .properties file.
> 
> I think that I misread your question and thought that you wanted to 
> client side scripting.
> 
> Cheers,
> 
> Simon
> 
> On Monday, April 28, 2003, at 02:21  pm, F.R. Da Costa Gomez wrote:
> 
> > I only need to send a simple string (back) to the server (that was
> > picked by the user, so there is no direct relationship to 
> an object on 
> > the server).
> > Is it really nescessary to create a whole new service for such a 
> > simple thing?
> >
> > Would it not be possible to use a DirectLink and its *parameters*
> > parameter or something similar?
> > This looks ok but I'm not at all sure how to 'fill' the 
> *parameters*. 
> > Doing an parameters="string:tree.getSelected().UUID" just 
> throws the 
> > whole "...." to the server NOT the UUID.
> >
> > simon.robins wrote:
> >
> >> One possible way is to create a service to deal with this request
> >> which sends the UUID as a parameter
> >> then do something like this:
> >>
> >> dummyImage = new Image()
> >> dummyImage.src =
> >> "http://localhost:8080/context/app?service=treeservice&UUID=????"
> >>
> >> On Monday, April 28, 2003, at 11:55  am, F.R. Da Costa Gomez wrote:
> >>
> >>> Hi all,
> >>>
> >>> I was wondering whether someone could help me with the 
> following: On 
> >>> a page I can get a uuid by means of the statement: 
> >>> tree.getSelected().UUID I need to get this uuid to the server in 
> >>> order to retrieve the object in question to do 'stuff' with it.
> >>>
> >>> I am assuming it is rather simple but for now I have not been able
> >>> to figure it out.
> >>> If someone could put me in the right direction it would be much 
> >>> appreciated.
> >>>
> >>> 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
> 


Re: Javascript: How to send value to server

Posted by "simon.robins" <si...@mac.com>.
Hi

This:

parameters="string:tree.getSelected().UUID"

should probably be this:

parameters="ognl:tree.selected.UUID"

assuming that there is an accessor getTree in the base class for this 
page and a getSelected method in the class returned by getTree and a 
getUUID method in the class returned by getSelected. Phew!

'string:' gets localized strings out of the relevant .properties file.

I think that I misread your question and thought that you wanted to 
client side scripting.

Cheers,

Simon

On Monday, April 28, 2003, at 02:21  pm, F.R. Da Costa Gomez wrote:

> I only need to send a simple string (back) to the server (that was 
> picked by the user, so there is no direct relationship to an object on 
> the server).
> Is it really nescessary to create a whole new service for such a 
> simple thing?
>
> Would it not be possible to use a DirectLink and its *parameters* 
> parameter or something similar?
> This looks ok but I'm not at all sure how to 'fill' the *parameters*. 
> Doing an parameters="string:tree.getSelected().UUID" just throws the 
> whole "...." to the server NOT the UUID.
>
> simon.robins wrote:
>
>> One possible way is to create a service to deal with this request 
>> which sends the UUID as a parameter
>> then do something like this:
>>
>> dummyImage = new Image()
>> dummyImage.src = 
>> "http://localhost:8080/context/app?service=treeservice&UUID=????"
>>
>> On Monday, April 28, 2003, at 11:55  am, F.R. Da Costa Gomez wrote:
>>
>>> Hi all,
>>>
>>> I was wondering whether someone could help me with the following:
>>> On a page I can get a uuid by means of the statement: 
>>> tree.getSelected().UUID
>>> I need to get this uuid to the server in order to retrieve the 
>>> object in question to do 'stuff' with it.
>>>
>>> I am assuming it is rather simple but for now I have not been able 
>>> to figure it out.
>>> If someone could put me in the right direction it would be much 
>>> appreciated.
>>>
>>> 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: Javascript: How to send value to server

Posted by "F.R. Da Costa Gomez" <dc...@fixed.com>.
I only need to send a simple string (back) to the server (that was 
picked by the user, so there is no direct relationship to an object on 
the server).
Is it really nescessary to create a whole new service for such a simple 
thing?

Would it not be possible to use a DirectLink and its *parameters* 
parameter or something similar?
This looks ok but I'm not at all sure how to 'fill' the *parameters*. 
Doing an parameters="string:tree.getSelected().UUID" just throws the 
whole "...." to the server NOT the UUID.

simon.robins wrote:

> One possible way is to create a service to deal with this request 
> which sends the UUID as a parameter
> then do something like this:
>
> dummyImage = new Image()
> dummyImage.src = 
> "http://localhost:8080/context/app?service=treeservice&UUID=????"
>
> On Monday, April 28, 2003, at 11:55  am, F.R. Da Costa Gomez wrote:
>
>> Hi all,
>>
>> I was wondering whether someone could help me with the following:
>> On a page I can get a uuid by means of the statement: 
>> tree.getSelected().UUID
>> I need to get this uuid to the server in order to retrieve the object 
>> in question to do 'stuff' with it.
>>
>> I am assuming it is rather simple but for now I have not been able to 
>> figure it out.
>> If someone could put me in the right direction it would be much 
>> appreciated.
>>
>> TIA,
>> Fermin DCG
>



Re: Javascript: How to send value to server

Posted by "simon.robins" <si...@mac.com>.
One possible way is to create a service to deal with this request which 
sends the UUID as a parameter
then do something like this:

dummyImage = new Image()
dummyImage.src = 
"http://localhost:8080/context/app?service=treeservice&UUID=????"

On Monday, April 28, 2003, at 11:55  am, F.R. Da Costa Gomez wrote:

> Hi all,
>
> I was wondering whether someone could help me with the following:
> On a page I can get a uuid by means of the statement: 
> tree.getSelected().UUID
> I need to get this uuid to the server in order to retrieve the object 
> in question to do 'stuff' with it.
>
> I am assuming it is rather simple but for now I have not been able to 
> figure it out.
> If someone could put me in the right direction it would be much 
> appreciated.
>
> TIA,
> Fermin DCG
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>