You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by MattHouston <ol...@gmail.com> on 2006/12/06 18:05:27 UTC

XTile and cycle.activate

Hi !

I have a probleme using the XTile component and cycle.activate.
I do sth in AJAX with XTile and in my Java function who handle requests,
sometimes i only receive and send requests to the client, that works good.
But i would like to sometimes not send a request but activate another page,
I thought I can do that with cycle.activate, but it doesn't works...

The code of my function : 

	public void handleListOfMailsRequest(IRequestCycle cycle) {
		Object[] params = ((RequestCycle) cycle).getServiceParameters();
		System.out.println("length parmas : "+params.length);
		if (params.length == 0) return;
		
		if (params[0].equals("isNews")) { // works good
                        [...]
			
			String[] ret = {mm.getDate(), mm.getFrom(), mm.getSubject(),
mm.getSize(), "false", mm.getId()};
			((RequestCycle) cycle).setServiceParameters(ret);
		}
		else { //dont work
			cycle.activate(NoviaMail_ReadMail);
		}
	}

Any help will be apprecated.
Thanks

MattHouston
-- 
View this message in context: http://www.nabble.com/XTile-and-cycle.activate-tf2769341.html#a7723360
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: XTile and cycle.activate

Posted by MattHouston <ol...@gmail.com>.
Thanks for your answer.

I've just a problem with your solution : ILink link =
svc.getLink(false,params) doesn't work. This instruction stop the execution
but don't get any error message...
I've tested it with differents solutions :
1/
	@InjectPage("NoviaMail_ReadMail")
	public abstract ReadMail getReadMail();
       
       ILink link = svc.getLink(false, getReadMail());

2/ ILink link = svc.getLink(false, "NoviaMail_ReadMail);

No one works... Have you got any idea ?



Jessek wrote:
> 
> I should clarify, this all works when using the normal core ajax
> services provided in 4.1.1, not specifically in the XTile service.
> 
> On 12/6/06, Jesse Kuhnert <jk...@gmail.com> wrote:
>> FYI, this all "just works" as expected in t 4.1.1. (the solution is
>> still a little questionable but it's the best default behavior I could
>> think of so far)
>>
>> On 12/6/06, Robert Zeigler <ro...@scazdl.org> wrote:
>> > cycle.activate will make the "activated" page be the page that renders.
>> > However... the xtile service doesn't result in a page render. It
>> results
>> > in an "ajax" response; hence, cycle.activate won't work. What you might
>> > consider doing is putting the url of the page you want to activate into
>> > the service parameters.  Then you could just replace the document
>> > location with the new url. Something along the lines of:
>> >
>> > else {
>> >    IEngineSerivce svc =
>> cycle.getEngine().getService(Tapestry.PAGE_SERVICE);
>> >    Object[] params = new Object[] { "NoviaMail_ReadMail" };
>> >    ILink link = svc.getLink(false,params);
>> >    cycle.setServiceParameters(new Object[]
>> > {"redirect",link.getAbsoluteURL()});
>> > }
>> >
>> > and in javascript, something like:
>> >
>> > my_function(params) {
>> >    if (params[0] == "redirect") {
>> >      document.location.href=params[1];
>> >      return;
>> >    }
>> >    ...
>> > }
>> >
>> > Something along those lines.
>> >
>> > Robert
>> >
>> > MattHouston wrote:
>> > > Hi !
>> > >
>> > > I have a probleme using the XTile component and cycle.activate.
>> > > I do sth in AJAX with XTile and in my Java function who handle
>> requests,
>> > > sometimes i only receive and send requests to the client, that works
>> good.
>> > > But i would like to sometimes not send a request but activate another
>> page,
>> > > I thought I can do that with cycle.activate, but it doesn't works...
>> > >
>> > > The code of my function :
>> > >
>> > >       public void handleListOfMailsRequest(IRequestCycle cycle) {
>> > >               Object[] params = ((RequestCycle)
>> cycle).getServiceParameters();
>> > >               System.out.println("length parmas : "+params.length);
>> > >               if (params.length == 0) return;
>> > >
>> > >               if (params[0].equals("isNews")) { // works good
>> > >                         [...]
>> > >
>> > >                       String[] ret = {mm.getDate(), mm.getFrom(),
>> mm.getSubject(),
>> > > mm.getSize(), "false", mm.getId()};
>> > >                       ((RequestCycle)
>> cycle).setServiceParameters(ret);
>> > >               }
>> > >               else { //dont work
>> > >                       cycle.activate(NoviaMail_ReadMail);
>> > >               }
>> > >       }
>> > >
>> > > Any help will be apprecated.
>> > > Thanks
>> > >
>> > > MattHouston
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>>
>> --
>> Jesse Kuhnert
>> Tapestry/Dojo team member/developer
>>
>> Open source based consulting work centered around
>> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>>
> 
> 
> -- 
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
> 
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/XTile-and-cycle.activate-tf2769341.html#a7738544
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: XTile and cycle.activate

Posted by Jesse Kuhnert <jk...@gmail.com>.
I should clarify, this all works when using the normal core ajax
services provided in 4.1.1, not specifically in the XTile service.

On 12/6/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> FYI, this all "just works" as expected in t 4.1.1. (the solution is
> still a little questionable but it's the best default behavior I could
> think of so far)
>
> On 12/6/06, Robert Zeigler <ro...@scazdl.org> wrote:
> > cycle.activate will make the "activated" page be the page that renders.
> > However... the xtile service doesn't result in a page render. It results
> > in an "ajax" response; hence, cycle.activate won't work. What you might
> > consider doing is putting the url of the page you want to activate into
> > the service parameters.  Then you could just replace the document
> > location with the new url. Something along the lines of:
> >
> > else {
> >    IEngineSerivce svc = cycle.getEngine().getService(Tapestry.PAGE_SERVICE);
> >    Object[] params = new Object[] { "NoviaMail_ReadMail" };
> >    ILink link = svc.getLink(false,params);
> >    cycle.setServiceParameters(new Object[]
> > {"redirect",link.getAbsoluteURL()});
> > }
> >
> > and in javascript, something like:
> >
> > my_function(params) {
> >    if (params[0] == "redirect") {
> >      document.location.href=params[1];
> >      return;
> >    }
> >    ...
> > }
> >
> > Something along those lines.
> >
> > Robert
> >
> > MattHouston wrote:
> > > Hi !
> > >
> > > I have a probleme using the XTile component and cycle.activate.
> > > I do sth in AJAX with XTile and in my Java function who handle requests,
> > > sometimes i only receive and send requests to the client, that works good.
> > > But i would like to sometimes not send a request but activate another page,
> > > I thought I can do that with cycle.activate, but it doesn't works...
> > >
> > > The code of my function :
> > >
> > >       public void handleListOfMailsRequest(IRequestCycle cycle) {
> > >               Object[] params = ((RequestCycle) cycle).getServiceParameters();
> > >               System.out.println("length parmas : "+params.length);
> > >               if (params.length == 0) return;
> > >
> > >               if (params[0].equals("isNews")) { // works good
> > >                         [...]
> > >
> > >                       String[] ret = {mm.getDate(), mm.getFrom(), mm.getSubject(),
> > > mm.getSize(), "false", mm.getId()};
> > >                       ((RequestCycle) cycle).setServiceParameters(ret);
> > >               }
> > >               else { //dont work
> > >                       cycle.activate(NoviaMail_ReadMail);
> > >               }
> > >       }
> > >
> > > Any help will be apprecated.
> > > Thanks
> > >
> > > MattHouston
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: XTile and cycle.activate

Posted by Jesse Kuhnert <jk...@gmail.com>.
FYI, this all "just works" as expected in t 4.1.1. (the solution is
still a little questionable but it's the best default behavior I could
think of so far)

On 12/6/06, Robert Zeigler <ro...@scazdl.org> wrote:
> cycle.activate will make the "activated" page be the page that renders.
> However... the xtile service doesn't result in a page render. It results
> in an "ajax" response; hence, cycle.activate won't work. What you might
> consider doing is putting the url of the page you want to activate into
> the service parameters.  Then you could just replace the document
> location with the new url. Something along the lines of:
>
> else {
>    IEngineSerivce svc = cycle.getEngine().getService(Tapestry.PAGE_SERVICE);
>    Object[] params = new Object[] { "NoviaMail_ReadMail" };
>    ILink link = svc.getLink(false,params);
>    cycle.setServiceParameters(new Object[]
> {"redirect",link.getAbsoluteURL()});
> }
>
> and in javascript, something like:
>
> my_function(params) {
>    if (params[0] == "redirect") {
>      document.location.href=params[1];
>      return;
>    }
>    ...
> }
>
> Something along those lines.
>
> Robert
>
> MattHouston wrote:
> > Hi !
> >
> > I have a probleme using the XTile component and cycle.activate.
> > I do sth in AJAX with XTile and in my Java function who handle requests,
> > sometimes i only receive and send requests to the client, that works good.
> > But i would like to sometimes not send a request but activate another page,
> > I thought I can do that with cycle.activate, but it doesn't works...
> >
> > The code of my function :
> >
> >       public void handleListOfMailsRequest(IRequestCycle cycle) {
> >               Object[] params = ((RequestCycle) cycle).getServiceParameters();
> >               System.out.println("length parmas : "+params.length);
> >               if (params.length == 0) return;
> >
> >               if (params[0].equals("isNews")) { // works good
> >                         [...]
> >
> >                       String[] ret = {mm.getDate(), mm.getFrom(), mm.getSubject(),
> > mm.getSize(), "false", mm.getId()};
> >                       ((RequestCycle) cycle).setServiceParameters(ret);
> >               }
> >               else { //dont work
> >                       cycle.activate(NoviaMail_ReadMail);
> >               }
> >       }
> >
> > Any help will be apprecated.
> > Thanks
> >
> > MattHouston
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: XTile and cycle.activate

Posted by Robert Zeigler <ro...@scazdl.org>.
cycle.activate will make the "activated" page be the page that renders.
However... the xtile service doesn't result in a page render. It results 
in an "ajax" response; hence, cycle.activate won't work. What you might 
consider doing is putting the url of the page you want to activate into 
the service parameters.  Then you could just replace the document 
location with the new url. Something along the lines of:

else {
   IEngineSerivce svc = cycle.getEngine().getService(Tapestry.PAGE_SERVICE);
   Object[] params = new Object[] { "NoviaMail_ReadMail" };
   ILink link = svc.getLink(false,params);
   cycle.setServiceParameters(new Object[] 
{"redirect",link.getAbsoluteURL()});
}

and in javascript, something like:

my_function(params) {
   if (params[0] == "redirect") {
     document.location.href=params[1];
     return;
   }
   ...
}

Something along those lines.

Robert

MattHouston wrote:
> Hi !
> 
> I have a probleme using the XTile component and cycle.activate.
> I do sth in AJAX with XTile and in my Java function who handle requests,
> sometimes i only receive and send requests to the client, that works good.
> But i would like to sometimes not send a request but activate another page,
> I thought I can do that with cycle.activate, but it doesn't works...
> 
> The code of my function : 
> 
> 	public void handleListOfMailsRequest(IRequestCycle cycle) {
> 		Object[] params = ((RequestCycle) cycle).getServiceParameters();
> 		System.out.println("length parmas : "+params.length);
> 		if (params.length == 0) return;
> 		
> 		if (params[0].equals("isNews")) { // works good
>                         [...]
> 			
> 			String[] ret = {mm.getDate(), mm.getFrom(), mm.getSubject(),
> mm.getSize(), "false", mm.getId()};
> 			((RequestCycle) cycle).setServiceParameters(ret);
> 		}
> 		else { //dont work
> 			cycle.activate(NoviaMail_ReadMail);
> 		}
> 	}
> 
> Any help will be apprecated.
> Thanks
> 
> MattHouston



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


Re: XTile and cycle.activate

Posted by MattHouston <ol...@gmail.com>.
Re

I have found another way to make this work.

Thanks for all
CU

MattHouston


MattHouston wrote:
> 
> Hi !
> 
> I have a probleme using the XTile component and cycle.activate.
> I do sth in AJAX with XTile and in my Java function who handle requests,
> sometimes i only receive and send requests to the client, that works good.
> But i would like to sometimes not send a request but activate another
> page, I thought I can do that with cycle.activate, but it doesn't works...
> 
> The code of my function : 
> 
> 	public void handleListOfMailsRequest(IRequestCycle cycle) {
> 		Object[] params = ((RequestCycle) cycle).getServiceParameters();
> 		System.out.println("length parmas : "+params.length);
> 		if (params.length == 0) return;
> 		
> 		if (params[0].equals("isNews")) { // works good
>                         [...]
> 			
> 			String[] ret = {mm.getDate(), mm.getFrom(), mm.getSubject(),
> mm.getSize(), "false", mm.getId()};
> 			((RequestCycle) cycle).setServiceParameters(ret);
> 		}
> 		else { //dont work
> 			cycle.activate(NoviaMail_ReadMail);
> 		}
> 	}
> 
> Any help will be apprecated.
> Thanks
> 
> MattHouston
> 

-- 
View this message in context: http://www.nabble.com/XTile-and-cycle.activate-tf2769341.html#a7741161
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