[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: Sending Form data to an external page
From:       Paul Ferraro <pmf8 () columbia ! edu>
Date:       2004-11-30 23:19:28
Message-ID: 41AD0000.1010601 () columbia ! edu
[Download RAW message or body]

Why not just use a regular html form and populate the form elements 
using the Any component?

<form action="http://paypal.com/transfer.do" method="post">
    Amount: <input name="amount" type="text"/>
    <input jwcid="@Any" name="fromAcct" value="ognl:accountNumber1" 
type="hidden"/>
    <input jwcid="@Any" name="toAcct" value="ognl:accountNumber2" 
type="hidden"/>
    <!-- etc.. -->
</form>

To answer your specific questions...

1.) Although I am not familiar with this section of the book, the 
functionality provided by throwing a "RedirectException" is fairly 
simple.  All it does is forward to a specified url if the url is 
relative, or redirect to a specified url if the url is absolute.  If you 
want to send a query string along with, you'll need to construct the url 
manually.
e.g.

StringBuffer buffer = new StringBuffer("http://paypal.com/transfer.do");
buffer.append("?fromAcct=").append(accountNumber1);
buffer.append("&toAcct=").append(accountNumber2);
buffer.append("&amount=").append(amount);
throw new RedirectException(buffer.toString());

2.) You can hardwire names to any type of form element like this:

<input jwcid="customName@Hidden" value=""/>

generates...

<input name="customName" value="" type="hidden"/>

Paul

dwm@vigilantms.com wrote:

>What is the best way to send form data to an external page.  I'm trying to
>set up a form to take the items out of a shopping cart and post them to a
>PayPal cart, which expects specified parameters.    According to chapter 8
>in TIA, the RedirectionException should send the request parameters by
>calling the RequestDispatcher and invoking the forward() method, but they
>don't seem to be sent.   
>
>Also,  Is there a way to control the "name" field of the hidden component so
>that the field matches what PayPal expects and not the name the framework
>generates?
>
>David Moran
>
>
>
>---------------------------------------------------------------------
>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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic