You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Valentin Yerastov <xi...@gmail.com> on 2009/05/15 07:52:22 UTC

actionlink ajax double request

Hello users and developers!

I have template:

<t:zone t:id="output"> ${value} </t:zone>
<t:actionlink t:id="update" zone="output">UPDATE</t:actionlink>

And page class:

@Persist
private int value;
	
@InjectComponent("output")
private Zone output;

@Inject
private Request request;
	
public Object onActionFromUpdate() {
        value++;
	if (request.isXHR()) {
		return output.getBody();
	} else {
		return null;
	}
}

This code almost from tapestry example.

When I click on link, browser send two request: first using AJAX (POST) and
secondary ordinary link behavior (GET).

Just like there are no "return false" on link event handler in javascript.

How I can avoid this behavior? I need only one AJAX request.
-- 
View this message in context: http://n2.nabble.com/actionlink-ajax-double-request-tp2906180p2906180.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: actionlink ajax double request

Posted by Robert Zeigler <ro...@scazdl.org>.
I would start by checking for JS errors that are preventing the ajax/ 
zone handling from completing properly.

Robert

On May 15, 2009, at 5/1512:56 AM , Valentin Yerastov wrote:

>
> Sorry, I forgot
>
> Tapestry version: 5.1.0.5
> Browser: Firefox
>
>
> Valentin Yerastov wrote:
>>
>> Hello users and developers!
>>
>> I have template:
>>
>> <t:zone t:id="output"> ${value} </t:zone>
>> <t:actionlink t:id="update" zone="output">UPDATE</t:actionlink>
>>
>> And page class:
>>
>> @Persist
>> private int value;
>> 	
>> @InjectComponent("output")
>> private Zone output;
>>
>> @Inject
>> private Request request;
>> 	
>> public Object onActionFromUpdate() {
>>        value++;
>> 	if (request.isXHR()) {
>> 		return output.getBody();
>> 	} else {
>> 		return null;
>> 	}
>> }
>>
>> This code almost from tapestry example.
>>
>> When I click on link, browser send two request: first using AJAX  
>> (POST)
>> and secondary ordinary link behavior (GET).
>>
>> Just like there are no "return false" on link event handler in  
>> javascript.
>>
>> How I can avoid this behavior? I need only one AJAX request.
>>
>
> -- 
> View this message in context: http://n2.nabble.com/actionlink-ajax-double-request-tp2906180p2906189.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: actionlink ajax double request

Posted by Valentin Yerastov <xi...@gmail.com>.
Sorry, I forgot

Tapestry version: 5.1.0.5
Browser: Firefox


Valentin Yerastov wrote:
> 
> Hello users and developers!
> 
> I have template:
> 
> <t:zone t:id="output"> ${value} </t:zone>
> <t:actionlink t:id="update" zone="output">UPDATE</t:actionlink>
> 
> And page class:
> 
> @Persist
> private int value;
> 	
> @InjectComponent("output")
> private Zone output;
> 
> @Inject
> private Request request;
> 	
> public Object onActionFromUpdate() {
>         value++;
> 	if (request.isXHR()) {
> 		return output.getBody();
> 	} else {
> 		return null;
> 	}
> }
> 
> This code almost from tapestry example.
> 
> When I click on link, browser send two request: first using AJAX (POST)
> and secondary ordinary link behavior (GET).
> 
> Just like there are no "return false" on link event handler in javascript.
> 
> How I can avoid this behavior? I need only one AJAX request.
> 

-- 
View this message in context: http://n2.nabble.com/actionlink-ajax-double-request-tp2906180p2906189.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org