Gently Quick Start

Please study the following example. It consist of a specification of a very simple JSP system. The first line specifies the location of the resulting system within your site. Your web server has to be configured appropriately.



The specified system encompasses two central Java Server Pages. The main page may be invoked only without any parameters. Then the user is shown a link and a form. The other important Java Server Page in this system is the so called help page. It may be invoked with an integer value from a link named inMain1 in the main page. This invocation is named show. Actually it is the invocation of what we call a Gently method. It may be invoked with a complex parameter set from a form named inMain2 in the main page. This method is named push. There are a lot of other possible links in the system. For example, there is a form in the menu which is intended to be a search form. On submit it calls the search method of the help page.

location = http://localhost:8080/test/gently/nod/ jsp Main { main(){ called by inShow from Help.show or called by redirect from Help.push or called by inSearch from Help.search or called by inMenu1 from menu and link inMain1 calls Help.show(id) or form inMain2 calls Help.push(TEXT quantity, TEXTAREA note, CHECKBOX flag, RADIO choice, COMBOBOX selection, MULTIPLELIST articles, MULTIPLELIST counts, HIDDEN hiddeni, HIDDEN hiddens) } } jsp Help { show(int articleId){ called by inMain1 from Main.main and link inShow calls Main.main() } push(int i1, // TEXT quantity String s1, // TEXTAREA note boolean b, // CHECKBOX flag String s2, // RADIO choice String s3, // COMBOBOX selection String[] ss1, // MULTIPLELIST articles int[] is, // MULTIPLELIST counts int i2, // HIDDEN hiddeni String[] ss2) // HIDDEN hiddens { called by inMain2 from Main.main and redirect Main.main() } search(String query){ called by inMenu2 from menu and link inSearch calls Main.main() } } menu { link inMenu1 calls Main.main() or form inMenu2 calls Help.search(TEXT querystring) }



Now store this specification to a file named test and invoke the Gently generator with it.

Gently generates the following files:

These resulting files already realize a complete dialogue. Make this system run with your web server and explore its linkage structure.

Customization

Now try the following changes to the system.

// replace the following code with custom code... querystring_ = ""; // default value of a form's textfield...

[ <A HREF="http://localhost:8080/test/gently/nod/Main.jsp?selectedMethod=main" target="show"> <!-- replace the following linkname... --> <!--inMenu1--> Main </A> ]

int id_; // BEGIN OF PROTECTED REGION FOR HYPERLINK "inMain1" // replace the following hyperlink's default values... id_ = <!-- 0 --> 4711; // END OF PROTECTED REGION FOR HYPERLINK "inMain1"

// if (false) { if (true) { pageContext.forward("Main.jsp?selectedMethod=main"); }

// BEGIN OF PROTECTED REGION FOR FORM "inMain2" // replace the following code with custom code... quantity_ = 1; // default value of a form's textfield... note_ = ""; // default value of a form's textarea... flag_ = true; // default value of a form's checkbox field... // default array and values of a form's radio button enumeration // and default array and values for it's labels... choice_ = new String[3]; choice_[0]="one"; choice_[1]="two"; choice_[2]="three"; choice_label = new String[3]; choice_label[0] = "One"; choice_label[1] = "Two"; choice_label[2] = "Three"; // default array and values of a form's combobox enumeration // and default array and values for it's entries... selection_ = new String[4]; selection_[0]="a"; selection_[1]="b"; selection_[2]="c"; selection_[3]="d"; selection_label = new String[4]; selection_label[0] = "A"; selection_label[1] = "B"; selection_label[2] = "C"; selection_label[3] = "D"; // default array and values of a form's multiple select // and default array and values for it's entries... articles_ = new String[2]; articles_[0]="Cap"; articles_[1]="Shirt"; articles_label = new String[2]; articles_label[0] = "Nice Cap"; articles_label[1] = "Nice Shirt"; // default array and values of a form's multiple select // and default array and values for it's entries... counts_ = new int[4]; counts_[0]=12; counts_[1]=23; counts_[2]=24; counts_[3]=56; counts_label = new String[4]; counts_label[0] = "foo"; counts_label[1] = "foo"; counts_label[2] = "foo"; counts_label[3] = "foo"; hiddeni_ = 0; // make sure, that this hidden parameter is assigned a value... // default array and values of hidden parameters hiddens_ = new String[5]; hiddens_[0]="hello"; hiddens_[1]="world"; hiddens_[2]="how"; hiddens_[3]="are"; hiddens_[4]="you"; // END OF PROTECTED REGION FOR FORM "inMain2"