You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Claudia Schmuck <cl...@web.de> on 2005/01/06 08:04:07 UTC

form post on external page

I am looking to do something equivalent to a simple html-form like this 
with Tapestry:

<form method="post" action="https://www.somewhere.com/somepage.asp">
	<input type="hidden" name="var1" value="1"/>
	<input type="hidden" name="var2" value="2"/>
	<input type="text" name="var2"/>
	<input type="submit" value="Submit"/>
</form>

My problem is, that I do not know how to make activate the external page 
in the action attribute, and then how to post parameters.

I am sure this is a very basic thing, but I have not been able to find 
any documentation on it in my book or on the web.

Could someone please either tell me where to read up on this problem or 
how to do it?

Thanks


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


Re: form post on external page

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 6, 2005, at 11:27 PM, Claudia Schmuck wrote:
> I guess  I put that wrong, let me try again: What I want to do is NOT 
> receive parameters from some html page, but have a Form component on 
> my page that posts parameters to some other page, 
> "https://www.somewhere.com/somepage.asp" in my example, a page that is 
> not part of my application.

In this case, there is no need to use a form "component".  Simply use 
<form>.  If you need to make some parameters dynamic, like hidden 
fields that pull information from your Tapestry application, use @Any:

	<input jwcid="@Any" type="hidden" value="ognl:whatever..."/>

Erik


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


Re: form post on external page

Posted by phillip rhodes <rh...@yahoo.com>.
In this case, you are going to have to do a http post
to the other page.  Look at the http client project in
jakarta commons.  They have some examples of posting
to  web pages and retrieving the results.  There is
nothing specific to tapestry (or struts, webwork,
whatever) that would do this for you without lots of
work!


Hopefully this answers your question.



--- Claudia Schmuck <cl...@gmail.com> wrote:

> Erik Hatcher wrote:
> > 
> > On Jan 6, 2005, at 2:04 AM, Claudia Schmuck wrote:
> > 
> >> I am looking to do something equivalent to a
> simple html-form like 
> >> this with Tapestry:
> >>
> >> <form method="post"
> action="https://www.somewhere.com/somepage.asp">
> >>     <input type="hidden" name="var1" value="1"/>
> >>     <input type="hidden" name="var2" value="2"/>
> >>     <input type="text" name="var2"/>
> >>     <input type="submit" value="Submit"/>
> >> </form>
> >>
> >> My problem is, that I do not know how to make
> activate the external 
> >> page in the action attribute, and then how to
> post parameters.
> >>
> >> I am sure this is a very basic thing, but I have
> not been able to find 
> >> any documentation on it in my book or on the web.
> >>
> >> Could someone please either tell me where to read
> up on this problem 
> >> or how to do it?
> > 
> > 
> > The trick to posting a form to an IExternalPage
> from forms not generated 
> > by Tapestry is to add this hidden field:
> > 
> >     <input type="hidden" name="service"
> value="external/Search"/>
> > 
> > In your activateExternalPage method, pull the
> parameters from the 
> > request like you would in a servlet, for example:
> > 
> >     HttpServletRequest request =
> cycle.getRequestContext().getRequest();
> >     String param = request.getParameter("var2");
> > 
> > This has an un-Tapestry-like feel to it, because
> it goes directly to the 
> > request, but this is the easiest and most sensible
> way I've found to 
> > integrate Tapestry into external HTML.
> > 
> >     Erik
> 
> 
> I guess  I put that wrong, let me try again: What I
> want to do is NOT 
> receive parameters from some html page, but have a
> Form component on my 
> page that posts parameters to some other page, 
> "https://www.somewhere.com/somepage.asp" in my
> example, a page that is 
> not part of my application.
> 
> Thanks
> 
>
---------------------------------------------------------------------
> 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


Re: form post on external page

Posted by Claudia Schmuck <cl...@gmail.com>.
Erik Hatcher wrote:
> 
> On Jan 6, 2005, at 2:04 AM, Claudia Schmuck wrote:
> 
>> I am looking to do something equivalent to a simple html-form like 
>> this with Tapestry:
>>
>> <form method="post" action="https://www.somewhere.com/somepage.asp">
>>     <input type="hidden" name="var1" value="1"/>
>>     <input type="hidden" name="var2" value="2"/>
>>     <input type="text" name="var2"/>
>>     <input type="submit" value="Submit"/>
>> </form>
>>
>> My problem is, that I do not know how to make activate the external 
>> page in the action attribute, and then how to post parameters.
>>
>> I am sure this is a very basic thing, but I have not been able to find 
>> any documentation on it in my book or on the web.
>>
>> Could someone please either tell me where to read up on this problem 
>> or how to do it?
> 
> 
> The trick to posting a form to an IExternalPage from forms not generated 
> by Tapestry is to add this hidden field:
> 
>     <input type="hidden" name="service" value="external/Search"/>
> 
> In your activateExternalPage method, pull the parameters from the 
> request like you would in a servlet, for example:
> 
>     HttpServletRequest request = cycle.getRequestContext().getRequest();
>     String param = request.getParameter("var2");
> 
> This has an un-Tapestry-like feel to it, because it goes directly to the 
> request, but this is the easiest and most sensible way I've found to 
> integrate Tapestry into external HTML.
> 
>     Erik


I guess  I put that wrong, let me try again: What I want to do is NOT 
receive parameters from some html page, but have a Form component on my 
page that posts parameters to some other page, 
"https://www.somewhere.com/somepage.asp" in my example, a page that is 
not part of my application.

Thanks

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


Re: form post on external page

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 6, 2005, at 2:04 AM, Claudia Schmuck wrote:

> I am looking to do something equivalent to a simple html-form like 
> this with Tapestry:
>
> <form method="post" action="https://www.somewhere.com/somepage.asp">
> 	<input type="hidden" name="var1" value="1"/>
> 	<input type="hidden" name="var2" value="2"/>
> 	<input type="text" name="var2"/>
> 	<input type="submit" value="Submit"/>
> </form>
>
> My problem is, that I do not know how to make activate the external 
> page in the action attribute, and then how to post parameters.
>
> I am sure this is a very basic thing, but I have not been able to find 
> any documentation on it in my book or on the web.
>
> Could someone please either tell me where to read up on this problem 
> or how to do it?

The trick to posting a form to an IExternalPage from forms not 
generated by Tapestry is to add this hidden field:

	<input type="hidden" name="service" value="external/Search"/>

In your activateExternalPage method, pull the parameters from the 
request like you would in a servlet, for example:

	HttpServletRequest request = cycle.getRequestContext().getRequest();
	String param = request.getParameter("var2");

This has an un-Tapestry-like feel to it, because it goes directly to 
the request, but this is the easiest and most sensible way I've found 
to integrate Tapestry into external HTML.

	Erik


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