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 with a DSP
 
Passing Parameters Between DSPs
Passing Parameters Between Services within a DSP
You use the standard HTTP “GET” and “POST” methods to pass input parameters to a DSP. In a browser-based client, you usually do this with an HTML form. For example, if you were creating an order-tracking application, you might create a form that prompts the user for an order number and invokes a DSP that returns the shipping status of that order.
You can use an HTML form to pass input to a DSP
Use an HTML <FORM> tag to invoke a DSP. Then, use HTML <INPUT> tags to pass input parameters to it.
<HTML>
<HEAD>
<TITLE>Order Tracking System</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFCC">
<H1>Shipping Information</H1>
<HR>
<FORM ACTION="/ORDER_TRAK/getorderinfo.dsp"
METHOD="GET">

<P>Enter Order Number <INPUT TYPE="TEXT" NAME="oNum"> <BR>
<INPUT TYPE="HIDDEN" NAME="action"
VALUE="shipinfo">
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>

<HR>
</BODY>
When the DSP is invoked, its initial scope encompasses two parameters: oNum and action. Services that you invoke within this scope receive an IData object containing these two elements.
The following code shows the contents of the DSP (getorderinfo.dsp) invoked by the previous example. It uses the value in action to conditionally execute a section of the DSP that invokes the service. (For more information about using the %switch% tag to conditionally execute a section of code, see Building Conditional Blocks with the %switch% Tag.)
<HTML>
<HEAD>
<title>Order Tracking System</title>
</HEAD>
<BODY BGCOLOR="#FFFFCC">

<!--User passes in order number in param named <oNum> -->
<!--and requested action in <action> -->

<H1>Order Tracking System</H1>
%switch action%
%case ‘shipinfo’%
%invoke orders:getShipInfo%
<p>
Order: %value /oNum%<br>
Date Shipped: %value shipDate%<br>
Carrier: %value carrier% %value serviceLevel%
</p>
%endinvoke%
%case ‘orderinfo’%
%invoke orders:getOrderInfo%
.
.
.