You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Butler <pe...@141.com> on 2004/02/08 01:33:44 UTC

Is it possible to forward from form submit to a custom service?

I have implemented a custom service for generating PDFs.  This works
fine when I link to it from within a page using a ServiceLink.

However, I need to collect a few parameters from a form, validate them
and then forward processing to the custom service for output as soon as
the form is submitted (i.e. so that the user doesn't have to click on a
link).  In other words, I need to do the equivalent of the following:

formSubmit(IRequestCycle cycle) {
  validateFormParameters();
  PDFService service =
(PDFService)cycle.getEngine().getService("PDFService");
  cycle.forwardTo(service); // Can't figure out this part!
}

Does anyone know how I can do this?

Thanks in advance

Peter Butler


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


RE: Is it possible to forward from form submit to a custom service? - Solved

Posted by Peter Butler <pe...@141.com>.
I finally found it myself (thanks to a later post from Norbi):

IEngineService pdfService =
cycle.getEngine().getService(PDFService.SERVICE_NAME);
String parameters[] = ...
String redirector = pdfService.getLink(cycle, null,
parameters).getURL();
throw new RedirectException(redirector);

Cheers

Peter

www.clever.co.nz

-----Original Message-----
From: Peter Butler [mailto:peter.butler@141.com] 
Sent: Sunday, 8 February 2004 1:34 p.m.
To: 'Tapestry users'
Subject: Is it possible to forward from form submit to a custom service?


I have implemented a custom service for generating PDFs.  This works
fine when I link to it from within a page using a ServiceLink.

However, I need to collect a few parameters from a form, validate them
and then forward processing to the custom service for output as soon as
the form is submitted (i.e. so that the user doesn't have to click on a
link).  In other words, I need to do the equivalent of the following:

formSubmit(IRequestCycle cycle) {
  validateFormParameters();
  PDFService service =
(PDFService)cycle.getEngine().getService("PDFService");
  cycle.forwardTo(service); // Can't figure out this part!
}

Does anyone know how I can do this?

Thanks in advance

Peter Butler


---------------------------------------------------------------------
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