Example: web.reg_save_param

The following examples are presented for web.reg_save_param.

Example 1: Saving simple text strings

Example: web.reg_save_param

In this example, web_reg_save_param saves a value from the response to a web_submit_form call. The value saved is used in a subsequent web_submit_form call.
In the Mercury Tours sample program, the server response to the submit_form call below contains the following radio button options:
	<tr bgcolor=#66cccc><th>Flight<th>Departure time<th>Cost
	<tr bgcolor=#66CCff><td align=center><input type = radio name=outboundFlight value=230;378;11/20/2003 checked >Blue Sky Air 230<td align=center>8am<td align=center>$ 378
	<tr bgcolor=#eeeeee><td align=center><input type = radio name=outboundFlight value=231;337;11/20/2003>Blue Sky Air 231<td align=center>1pm<td align=center>$ 337
and so on.

To submit a reservation, the outboundFlight value is required.

To reserve the default flight, save the "checked" value, and pass it to web_submit_form. The html segment for the default value is:
	name=outboundFlight value=230;378;11/20/2003 checked >
/*This web_reg_save_param call applies to the following action function: web_submit_form. */
    "LB=outboundFlight value=", "RB= checked >", LAST);
        "Name=depart", "Value=London", ENDITEM,
        "Name=departDate", "Value=11/20/2003", ENDITEM,
        "Name=arrive", "Value=New York", ENDITEM,
        "Name=returnDate", "Value=11/21/2003", ENDITEM,
        "Name=numPassengers", "Value=1", ENDITEM,
        "Name=roundtrip", "Value=<OFF>", ENDITEM,
        "Name=seatPref", "Value=None", ENDITEM,
        "Name=seatType", "Value=Coach", ENDITEM,
        "Name=findFlights.x", "Value=83", ENDITEM,
        "Name=findFlights.y", "Value=16", ENDITEM,
/* The result of the web_reg_save_param having been called before the web_submit_form is:
	Action.c(15): Notify: Saving Parameter "outFlightVal = 230;378;11/20/2003"

// Now use the saved outFlightVal

        "Name=outboundFlight", "Value={outFlightVal}", ENDITEM,
        "Name=reserveFlights.x", "Value=92", ENDITEM,
        "Name=reserveFlights.y", "Value=10", ENDITEM,
/* Action.c(34): Notify: Parameter Substitution: parameter "outFlightVal" = "230;378;11/20/2003" */

Java Language

web.reg_save_param (""outFlightVal",
    new String []{
        "LB=outboundFlight value=",
        "RB=>" , 
        "LAST"} );

Example: web.reg_save_param

Example 2: Saving a text by using binary boundaries

The following example uses BIN type boundaries. The left boundary is composed of 3F and DD. The right boundary is composed of CC and b.

    new String []{
        "LB/BIN=\\x3F\\xDD", "RB/BIN=\\xCCb", "LAST"});

Example: web.reg_save_param

Example 3: Saving a text specified with an offset and length

The following example specifies an offset and length. The boundaries for the HTML string "Astra on TESTSERVER", are "Astra " (note the space which follows the word) and "TestServer". This should return "on" but since the offset is 1 (i.e., start at the second character) and the length of data to save is 1, then the string saved to TestParam is "n".

    new String []{
        "LB=Astra ", "RB= TESTSERVER",
        "SaveOffset=1", "SaveLen=1", "LAST"});

Example: web.reg_save_param