provided by: 
Originally published at Internet.comGenerating dynamic content in Web applications is important when the content must reflect the most current and available data and personalized information One of the main advantages of JavaServer Pages is the ability to generate dynamic content. JSPs generate dynamic HTML pages by using Java control structures like for loops and if statements. As a result, forms can be generated dynamically following some specified logical layout.
Dynamic Forms
You can dynamically generate HTML forms by following a layout specification that a JSP code can use to create the form. This is especially useful when forms are used to gather information as part of a collection of data or a sequence.
One possible use of dynamic forms, together with dynamic tables, is an online-shopping cart. A shopping cart lists the items a user intends to purchase and information like: individual prices, short descriptions, quantities, subtotals, and a grand total of the purchase. The shopping cart can be created by combining HTML forms and tables. The table would tabulate the items in separate rows, with the information for each item filling different columns.
The form would gather the quantities for each item, so that subtotals can be computed for each item in the shopping cart. The user can input the quantities for each item (default would be 1) and they would click on a button that would refresh the cart when a change would be made. The rows of the table would be created using a for loop, and an INPUT field (TYPE=TEXT) would be inserted in the appropriate column for each of the items...
Read article at Internet.com site