Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | DSPs and building output templates | Using Dynamic Server Pages (DSPs) | Using the DSP Tags | Passing Parameters with a DSP | Passing Parameters Between DSPs
 
Passing Parameters Between DSPs
Because HTTP does not preserve variables from one request to another, to pass data from one DSP to another, you must explicitly set those values in the documents that you return to the requestor. For example, let’s say you want to allow your user to view or edit the shipment displayed by the order-tracking DSP above. To do this, you must return a document containing links to the DSPs that perform these tasks, and these DSPs will need the order number (oNum) that the user submitted on the original page. To pass the order number to these DSPs, you must put oNum in the page you return to the client.
The following example shows two ways in which you can build a DSP that will pass a variable to another DSP. The first portion of code in bold illustrates how you can pass a parameter in a hidden input element. The second portion of code in bold illustrates how you can pass a parameter as a name-value pair in a link to a DSP.
<HTML>
<HEAD>
<title>Order Tracking System</title>
</HEAD>
<BODY BGCOLOR="#FFFFCC">

<H1>Order Tracking System</H1>
<!--User passes in order number in param named <oNum> -->
<!--and requested action in <action> -->
%switch action%
%case ‘shipinfo’%
%invoke orders:getShipInfo%
<H2>Shipping Information for Order %value /oNum%</H2>
<P>Date Shipped: %value shipDate%<BR>
Carrier: %value carrier% %value serviceLevel%
</P>
<HR>
%ifvar shipDate -isnotempty%
<FORM ACTION="/ORDER_TRAK/editshipinfo.dsp" METHOD="get">
<P><B>Change this Shipment:</B></P>
<P><INPUT TYPE="RADIO" NAME="action" VALUE="edit">
Edit Shipment Details</P>
<P><INPUT TYPE="RADIO" NAME="action" VALUE="cancel">
Cancel this shipment</P>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="HIDDEN" NAME="oNum" VALUE="%value /oNum">
</FORM>
<HR>
%endifvar%
<P><A HREF="/ORDER_TRAK/getorderinfo.dsp
?action=orderinfo&oNum=%value /oNum%">View Entire Order</A></P>
%endinvoke%
%case ‘getorder’%
%invoke orders:getOrderInfo%
.
.
.