Re: Return page from ajax request
Despite the workarounds I think it would be much nicer if tapestry could handle this automatically and don't force the developer to think about that. I created an improvement request https://issues.apache.org/jira/browse/TAPESTRY-2618 On Mon, Aug 25, 2008 at 2:31 AM, Jun Tsai <[EMAIL PROTECTED]> wrote: > Object onAction(){ >JSONObject response = new JSONObject(); >response.put("script", "self.location='me';"); >response.put("content", "redirect ."); > >return response; > > } > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Return page from ajax request
Object onAction(){ JSONObject response = new JSONObject(); response.put("script", "self.location='me';"); response.put("content", "redirect ."); return response; }
Re: Return page from ajax request
That won't work for an Ajax request. The interpretation of the event handler method return value is different for Ajax requests than for traditional requests. Really, for page instances & etc., the Ajax handler should send (in the JSON response) a special property to let the client redirect to the new page. Please add an issue about this and we'll see about getting it implemented for the release candidate. On Sat, Aug 23, 2008 at 2:27 PM, Sven Homburg <[EMAIL PROTECTED]> wrote: > this should work: > > class FirstPage > { > @Inject > private OtherPage page > > Object myListener() > { >return page; > } > } > > > 2008/8/23 Markus Joschko <[EMAIL PROTECTED]> > >> Hi Andrew, >> have you found the solution? I try the same but using the normal page >> navigation patterns result into >> >> Caused by: java.lang.RuntimeException: A component event handler >> method returned the value profile/Profiles. Return type >> java.lang.String can not be handled. Configured return types are >> org.apache.tapestry5.StreamResponse, >> org.apache.tapestry5.json.JSONObject, >> org.apache.tapestry5.runtime.Component, >> org.apache.tapestry5.runtime.RenderCommand. >>at >> org.apache.tapestry5.internal.services.ObjectComponentEventResultProcessor.processResultValue(ObjectComponentEventResultProcessor.java:39) >>at >> $ComponentEventResultProcessor_11bf1136128.processResultValue($ComponentEventResultProcessor_11bf1136128.java) >>at >> $ComponentEventResultProcessor_11bf1136126.processResultValue($ComponentEventResultProcessor_11bf1136126.java) >>at >> org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper.handleResult(ComponentResultProcessorWrapper.java:42) >>at >> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$15.handleResult(ComponentPageElementImpl.java:1008) >>at >> org.apache.tapestry5.internal.services.EventImpl.storeResult(EventImpl.java:67) >> >> >> Thanks, >> Markus >> >> >> >> On Sun, Apr 27, 2008 at 11:06 PM, Andrew Court <[EMAIL PROTECTED]> >> wrote: >> > >> > Hi all, >> > >> > In T5, from an Ajax request, is it possible to redirect to a different >> page? >> > >> > What I'm trying to do is something like below: >> > >> > Object onSomeAjaxRequest(){ >> > >> > if(some condition){ >> > exit xhttp and jump to a different page >> > } >> > else{ >> > return xhttp response to same page >> > } >> > >> > } >> > >> > But this doesn't seem to work. >> > >> > Thanks for any pointers, >> > Andrew >> > -- >> > View this message in context: >> http://www.nabble.com/Return-page-from-ajax-request-tp16927742p16927742.html >> > Sent from the Tapestry - User mailing list archive at Nabble.com. >> > >> > >> > - >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > with regards > Sven Homburg > http://www.chenillekit.org > http://tapestry5-components.googlecode.com > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Return page from ajax request
@Sven, unfortunately this doesn't work but renders the page within the zone that is updated. On Sun, Aug 24, 2008 at 11:42 AM, Andrew Court <[EMAIL PROTECTED]> wrote: > > Hi Markus, > > Actually no. I couldn't find any way to make a conditional redirect from an > xhttp action method. > > My work around was to do the redirect on the client side based on the return > value of the action method, but unfortunately this means two trips to the > server. > > Let me know if you can find a solution. > > Andrew > > > > > Markus Joschko wrote: >> >> Hi Andrew, >> have you found the solution? I try the same but using the normal page >> navigation patterns result into >> >> Caused by: java.lang.RuntimeException: A component event handler >> method returned the value profile/Profiles. Return type >> java.lang.String can not be handled. Configured return types are >> org.apache.tapestry5.StreamResponse, >> org.apache.tapestry5.json.JSONObject, >> org.apache.tapestry5.runtime.Component, >> org.apache.tapestry5.runtime.RenderCommand. >> at >> org.apache.tapestry5.internal.services.ObjectComponentEventResultProcessor.processResultValue(ObjectComponentEventResultProcessor.java:39) >> at >> $ComponentEventResultProcessor_11bf1136128.processResultValue($ComponentEventResultProcessor_11bf1136128.java) >> at >> $ComponentEventResultProcessor_11bf1136126.processResultValue($ComponentEventResultProcessor_11bf1136126.java) >> at >> org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper.handleResult(ComponentResultProcessorWrapper.java:42) >> at >> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$15.handleResult(ComponentPageElementImpl.java:1008) >> at >> org.apache.tapestry5.internal.services.EventImpl.storeResult(EventImpl.java:67) >> >> >> Thanks, >> Markus >> >> >> >> On Sun, Apr 27, 2008 at 11:06 PM, Andrew Court <[EMAIL PROTECTED]> >> wrote: >>> >>> Hi all, >>> >>> In T5, from an Ajax request, is it possible to redirect to a different >>> page? >>> >>> What I'm trying to do is something like below: >>> >>> Object onSomeAjaxRequest(){ >>> >>> if(some condition){ >>> exit xhttp and jump to a different page >>> } >>> else{ >>> return xhttp response to same page >>> } >>> >>> } >>> >>> But this doesn't seem to work. >>> >>> Thanks for any pointers, >>> Andrew >>> -- >>> View this message in context: >>> http://www.nabble.com/Return-page-from-ajax-request-tp16927742p16927742.html >>> Sent from the Tapestry - User mailing list archive at Nabble.com. >>> >>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > -- > View this message in context: > http://www.nabble.com/Return-page-from-ajax-request-tp16927742p19129107.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Return page from ajax request
Hi Markus, Actually no. I couldn't find any way to make a conditional redirect from an xhttp action method. My work around was to do the redirect on the client side based on the return value of the action method, but unfortunately this means two trips to the server. Let me know if you can find a solution. Andrew Markus Joschko wrote: > > Hi Andrew, > have you found the solution? I try the same but using the normal page > navigation patterns result into > > Caused by: java.lang.RuntimeException: A component event handler > method returned the value profile/Profiles. Return type > java.lang.String can not be handled. Configured return types are > org.apache.tapestry5.StreamResponse, > org.apache.tapestry5.json.JSONObject, > org.apache.tapestry5.runtime.Component, > org.apache.tapestry5.runtime.RenderCommand. > at > org.apache.tapestry5.internal.services.ObjectComponentEventResultProcessor.processResultValue(ObjectComponentEventResultProcessor.java:39) > at > $ComponentEventResultProcessor_11bf1136128.processResultValue($ComponentEventResultProcessor_11bf1136128.java) > at > $ComponentEventResultProcessor_11bf1136126.processResultValue($ComponentEventResultProcessor_11bf1136126.java) > at > org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper.handleResult(ComponentResultProcessorWrapper.java:42) > at > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$15.handleResult(ComponentPageElementImpl.java:1008) > at > org.apache.tapestry5.internal.services.EventImpl.storeResult(EventImpl.java:67) > > > Thanks, > Markus > > > > On Sun, Apr 27, 2008 at 11:06 PM, Andrew Court <[EMAIL PROTECTED]> > wrote: >> >> Hi all, >> >> In T5, from an Ajax request, is it possible to redirect to a different >> page? >> >> What I'm trying to do is something like below: >> >> Object onSomeAjaxRequest(){ >> >> if(some condition){ >> exit xhttp and jump to a different page >> } >> else{ >> return xhttp response to same page >> } >> >> } >> >> But this doesn't seem to work. >> >> Thanks for any pointers, >> Andrew >> -- >> View this message in context: >> http://www.nabble.com/Return-page-from-ajax-request-tp16927742p16927742.html >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Return-page-from-ajax-request-tp16927742p19129107.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Return page from ajax request
this should work: class FirstPage { @Inject private OtherPage page Object myListener() { return page; } } 2008/8/23 Markus Joschko <[EMAIL PROTECTED]> > Hi Andrew, > have you found the solution? I try the same but using the normal page > navigation patterns result into > > Caused by: java.lang.RuntimeException: A component event handler > method returned the value profile/Profiles. Return type > java.lang.String can not be handled. Configured return types are > org.apache.tapestry5.StreamResponse, > org.apache.tapestry5.json.JSONObject, > org.apache.tapestry5.runtime.Component, > org.apache.tapestry5.runtime.RenderCommand. >at > org.apache.tapestry5.internal.services.ObjectComponentEventResultProcessor.processResultValue(ObjectComponentEventResultProcessor.java:39) >at > $ComponentEventResultProcessor_11bf1136128.processResultValue($ComponentEventResultProcessor_11bf1136128.java) >at > $ComponentEventResultProcessor_11bf1136126.processResultValue($ComponentEventResultProcessor_11bf1136126.java) >at > org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper.handleResult(ComponentResultProcessorWrapper.java:42) >at > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$15.handleResult(ComponentPageElementImpl.java:1008) >at > org.apache.tapestry5.internal.services.EventImpl.storeResult(EventImpl.java:67) > > > Thanks, > Markus > > > > On Sun, Apr 27, 2008 at 11:06 PM, Andrew Court <[EMAIL PROTECTED]> > wrote: > > > > Hi all, > > > > In T5, from an Ajax request, is it possible to redirect to a different > page? > > > > What I'm trying to do is something like below: > > > > Object onSomeAjaxRequest(){ > > > > if(some condition){ > > exit xhttp and jump to a different page > > } > > else{ > > return xhttp response to same page > > } > > > > } > > > > But this doesn't seem to work. > > > > Thanks for any pointers, > > Andrew > > -- > > View this message in context: > http://www.nabble.com/Return-page-from-ajax-request-tp16927742p16927742.html > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- with regards Sven Homburg http://www.chenillekit.org http://tapestry5-components.googlecode.com
Re: Return page from ajax request
Hi Andrew, have you found the solution? I try the same but using the normal page navigation patterns result into Caused by: java.lang.RuntimeException: A component event handler method returned the value profile/Profiles. Return type java.lang.String can not be handled. Configured return types are org.apache.tapestry5.StreamResponse, org.apache.tapestry5.json.JSONObject, org.apache.tapestry5.runtime.Component, org.apache.tapestry5.runtime.RenderCommand. at org.apache.tapestry5.internal.services.ObjectComponentEventResultProcessor.processResultValue(ObjectComponentEventResultProcessor.java:39) at $ComponentEventResultProcessor_11bf1136128.processResultValue($ComponentEventResultProcessor_11bf1136128.java) at $ComponentEventResultProcessor_11bf1136126.processResultValue($ComponentEventResultProcessor_11bf1136126.java) at org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper.handleResult(ComponentResultProcessorWrapper.java:42) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$15.handleResult(ComponentPageElementImpl.java:1008) at org.apache.tapestry5.internal.services.EventImpl.storeResult(EventImpl.java:67) Thanks, Markus On Sun, Apr 27, 2008 at 11:06 PM, Andrew Court <[EMAIL PROTECTED]> wrote: > > Hi all, > > In T5, from an Ajax request, is it possible to redirect to a different page? > > What I'm trying to do is something like below: > > Object onSomeAjaxRequest(){ > > if(some condition){ > exit xhttp and jump to a different page > } > else{ > return xhttp response to same page > } > > } > > But this doesn't seem to work. > > Thanks for any pointers, > Andrew > -- > View this message in context: > http://www.nabble.com/Return-page-from-ajax-request-tp16927742p16927742.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Return page from ajax request
Hi all, In T5, from an Ajax request, is it possible to redirect to a different page? What I'm trying to do is something like below: Object onSomeAjaxRequest(){ if(some condition){ exit xhttp and jump to a different page } else{ return xhttp response to same page } } But this doesn't seem to work. Thanks for any pointers, Andrew -- View this message in context: http://www.nabble.com/Return-page-from-ajax-request-tp16927742p16927742.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]