You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by dick_hu <di...@gmail.com> on 2011/07/12 04:02:29 UTC

A problem occur at loop of zone

First show my test code
test.tml

      
          ${str}
        
             delete
         
          

      


test.java
public class Test {
	@Property
	@Persist(PersistenceConstants.SESSION)
	private List strs;

	@Property
	private String str;

	@Property
	private int index;

	@InjectComponent
	private Zone testZone;

	void setupRender() {
		strs = new ArrayList();
		strs.add("1");
		strs.add("2");
		strs.add("3");
		strs.add("4");
		strs.add("5");
	}

	Zone onActionFromDelete(int index) {
		System.out.println(index);
		strs.remove(index);
		return testZone;
	}
}

I click the "delete" actionlink is right,the Zone updated,
but I click the "delete" actionlink,the page  refreshed,and my console show
the warn log

"2011-07-12 09:54:55,265 [ComponentInstanceResultProcessor]  WARN
[31761534@qtp0-4] (ComponentInstanceResultProcessor.java:49) - Component
test/Test:testzone was returned from an event handler method, but is not a
page component. The page containing the component will render the client
response."

I spend a lot of time,and can not sovle the problem,any one can help me.
Thanks a lot.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4577377.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: A problem occur at loop of zone

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 12 Jul 2011 23:42:02 -0300, dick_hu <di...@gmail.com> wrote:

> 	Block onActionFromDelete() {
> 		return testZone.getBody();
> 	}
> }
>
> but occur the exception like this
> A component event handler method returned the value Block[Body of
> test/Test:testzone, at classpath:com/lai2/pages/test/Test.tml, line 21].
> Return type org.apache.tapestry5.internal.structure.BlockImpl can not be
> handled.

This happens when a non-AJAX request is made and an AJAX event handler  
method value is returned.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: A problem occur at loop of zone

Posted by dick_hu <di...@gmail.com>.
when I a create a new project and try it ,it runs right.
I explore the problem,It's my mistake,I destroy the tapestry.js.
I am sorry to cost everyone a lot of time for the stupid mistake.
Thank you !

--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4581354.html
Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by dick_hu <di...@gmail.com>.
Thiago H. de Paula Figueiredo wrote:
> 
> On Tue, 12 Jul 2011 23:04:55 -0300, dick_hu &lt;dickannie@gmail.com&gt;
> wrote:
> 
>> 	Zone onActionFromDelete() {
>> 	    return testZone;
>> 	}
> 
> Return testZone.getBody() instead.
> 
> 
I according to your issue, 
public class Test {

	@InjectComponent
	private Zone testZone;

	Block onActionFromDelete() {
		return testZone.getBody();
	}
}

but occur the exception like this
A component event handler method returned the value Block[Body of
test/Test:testzone, at classpath:com/lai2/pages/test/Test.tml, line 21].
Return type org.apache.tapestry5.internal.structure.BlockImpl can not be
handled.


--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4581320.html
Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 12 Jul 2011 23:04:55 -0300, dick_hu <di...@gmail.com> wrote:

> 	Zone onActionFromDelete() {
> 	    return testZone;
> 	}

Return testZone.getBody() instead.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: A problem occur at loop of zone

Posted by Taha Hafeez <ta...@gmail.com>.
try setting the javascript id for zone

<t:zone t:id='zone' id='unique_zone_id'>

regards
Taha

On Wed, Jul 13, 2011 at 8:07 AM, dick_hu <di...@gmail.com> wrote:
>
> Taha Hafeez wrote:
> >
> > Hi
> >
> > I just copied your code and tried it, I works on firefox, chrome & opera.
> > What browser are you using ?
> >
> >
> I works on IE 8,
> first click is right,but second click the page reflesh,the actionlink is not
> return a zone.
> you alway is right?
>
> I want to create a new project try it, heihei :)
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4581312.html
> Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by dick_hu <di...@gmail.com>.
Taha Hafeez wrote:
> 
> Hi
> 
> I just copied your code and tried it, I works on firefox, chrome & opera.
> What browser are you using ?
> 
> 
I works on IE 8,
first click is right,but second click the page reflesh,the actionlink is not
return a zone.
you alway is right?

I want to create a new project try it, heihei :)

--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4581312.html
Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by Taha Hafeez <ta...@gmail.com>.
Hi

I just copied your code and tried it, I works on firefox, chrome & opera.
What browser are you using ?

regards
Taha

On Wed, Jul 13, 2011 at 7:34 AM, dick_hu <di...@gmail.com> wrote:

> this problem I still have not sovle.
> But I use MultiZoneUpdate as return type it runs success.
>
> I guess Is the actionlink inside in the zone,when the zone updated cause
> the
> actionlink's ajax action invalid.
> can you help me? I write a easiest test,but failure yet.
> test.tml
>   <t:zone t:id="testZone">
>             <t:actionlink t:id="delete" zone="testZone">
>                 delete
>            </t:actionlink>
>   </t:zone>
>
> test.java
> public class Test {
>         @InjectComponent
>        private Zone testZone;
>
>        Zone onActionFromDelete() {
>            return testZone;
>        }
> }
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4581253.html
> Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by dick_hu <di...@gmail.com>.
this problem I still have not sovle.
But I use MultiZoneUpdate as return type it runs success.

I guess Is the actionlink inside in the zone,when the zone updated cause the
actionlink's ajax action invalid.
can you help me? I write a easiest test,but failure yet.
test.tml
   <t:zone t:id="testZone">
            <t:actionlink t:id="delete" zone="testZone">
                delete
            </t:actionlink>
   </t:zone>

test.java
public class Test {
	@InjectComponent
	private Zone testZone;

	Zone onActionFromDelete() {
	    return testZone;
	}
}


--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4581253.html
Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by Taha Hafeez <ta...@gmail.com>.
For some reason your request is not being submitted as an ajax request. You
can verify it by

@Inject
private Request request;

@Inject
private Logger logger;

void onYourEventHandler(){
   logger.debug(request.isXHR());
}

This may be because of a JavaScript error, so try debugging through firebug
or chrome

regards
Taha


On Tue, Jul 12, 2011 at 7:43 AM, dick_hu <di...@gmail.com> wrote:

>
> Taha Hafeez wrote:
> >
> > The template is not visible, are you using zone parameter of
> > actionlink(you
> > should prefer eventlink over actionlink). Only then will the request be
> > ajax
> > based.
> >
> >
> the Test.tml
>
> <t:zone t:id="testZone">
>      <t:loop source="strs" value="str" index="index">
>          ${str}
>        <t:actionlink t:id="delete" zone="testZone" context="index">
>             delete
>         </t:actionlink>
>          <br/>
>      </t:loop>
> </t:zone>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4577397.html
> Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by dick_hu <di...@gmail.com>.
Taha Hafeez wrote:
> 
> The template is not visible, are you using zone parameter of
> actionlink(you
> should prefer eventlink over actionlink). Only then will the request be
> ajax
> based.
> 
> 
the Test.tml 

<t:zone t:id="testZone">
      <t:loop source="strs" value="str" index="index">
          ${str} 
        <t:actionlink t:id="delete" zone="testZone" context="index">
             delete 
         </t:actionlink>
          <br/>
      </t:loop>
</t:zone>


--
View this message in context: http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4577397.html
Sent from the Tapestry - User 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: A problem occur at loop of zone

Posted by Taha Hafeez <ta...@gmail.com>.
The template is not visible, are you using zone parameter of actionlink(you
should prefer eventlink over actionlink). Only then will the request be ajax
based.

regards
Taha



On Tue, Jul 12, 2011 at 7:32 AM, dick_hu <di...@gmail.com> wrote:

> First show my test code
> test.tml
>
>
>          ${str}
>
>             delete
>
>
>
>
>
>
> test.java
> public class Test {
>        @Property
>        @Persist(PersistenceConstants.SESSION)
>        private List strs;
>
>        @Property
>        private String str;
>
>        @Property
>        private int index;
>
>        @InjectComponent
>        private Zone testZone;
>
>        void setupRender() {
>                strs = new ArrayList();
>                strs.add("1");
>                strs.add("2");
>                strs.add("3");
>                strs.add("4");
>                strs.add("5");
>        }
>
>        Zone onActionFromDelete(int index) {
>                System.out.println(index);
>                strs.remove(index);
>                return testZone;
>        }
> }
>
> I click the "delete" actionlink is right,the Zone updated,
> but I click the "delete" actionlink,the page  refreshed,and my console show
> the warn log
>
> "2011-07-12 09:54:55,265 [ComponentInstanceResultProcessor]  WARN
> [31761534@qtp0-4] (ComponentInstanceResultProcessor.java:49) - Component
> test/Test:testzone was returned from an event handler method, but is not a
> page component. The page containing the component will render the client
> response."
>
> I spend a lot of time,and can not sovle the problem,any one can help me.
> Thanks a lot.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/A-problem-occur-at-loop-of-zone-tp4577377p4577377.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.