package e4s.tutorial;
import e4s.html.*;
import e4s.servlet.*;
import java.io.*;
// import java.awt.*;
import java.util.*;
import java.text.*;
import java.net.*;
import java.sql.*;
/**
* How to handle parameters when calling functions.
*
* {@tutorial Example_ParameterHandling}
*/
public class Example_ParameterHandling extends E4ModuleImplementation
{
public static E4Method simpleParameterHandling = null;
public static E4Method receivedParameters = null;
/**
* Handle some parameters throught a <A HREF=..>.
*
* @param html the HTML context, to be used for output.
*/
public void simpleParameterHandling(HTML html)
{
BODY body = html.BODY();
A href = body.A(receivedParameters);
href.addParameter("Name","Robert");
href.addParameter("Age",35);
href.addParameter("Gender",true);
href.print("[click here to continue]");
}
public void receivedParameters(HTML html, E4CgiParams params)
{
BODY body = html.BODY();
TABLE table = body.TABLE();
table.setBorder();
table.setCellspacing(0,0);
table.setBgColor(new E4Color(0xA0,0xA0,0xA0));
table.setBorderColor(E4Color.RED);
TR tr1 = table.TR();
tr1.TD().println("Received value for parameter 'Name':");
tr1.TD().println(params.get("Name"));
TR tr2 = table.TR();
tr2.TD().println("Received value for parameter 'Age':");
tr2.TD().println(params.get("Age"));
TR tr3 = table.TR();
tr3.TD().println("Received value for parameter 'Gender':");
tr3.TD().println(params.get("Gender"));
}
}