Xem mẫu

The JSP Files (part 4): The Red Pill By Vikram Vaswani This article copyright Melonfire 2000−2002. All rights reserved. The JSP Files (part 4): The Red Pill Table of Contents Applying The Theory..........................................................................................................................................1 The Last Action Hero.........................................................................................................................................2 Entering The Matrix...........................................................................................................................................4 Requesting More.................................................................................................................................................7 Taking Some Medication..................................................................................................................................10 What`s For Dessert?.........................................................................................................................................12 A Chocolate Addiction......................................................................................................................................14 Couch Potato.....................................................................................................................................................17 Beating It Into Submission...............................................................................................................................20 i Applying The Theory Last time out, we gave you a crash course in the numerous controls structures available to you in JSP − operators, conditional statements, and loops. But there`s a big difference between learning theory in a classroom and actually practicing it in the real world − which is why this issue of The JSP Files is devoted to a discussion of how JSP can be used to extract and use data from HTML forms. Over the next few pages, we`re going to show you how JSP can be used to process the data entered into a Web form − everything from simple text boxes to lists and checkboxes − and we`re also going to demonstrate how to use array variables in JSP. Applying The Theory 1 The Last Action Hero HTML forms are typically used to obtain information from visitors to a Web site − things like their name, mailing address, phone number, and the like − and this information is then processed in a variety of different ways. Some sites store it in a database; others email it to the webmaster; and still other simply redirect it to the trash basket. By using JSP to process a form, you can write simple code snippets that accomplish all of these actions. Let`s begin with a simple example.
Name, rank and serial, number, soldier!
The Last Action Hero 2 The JSP Files (part 4): The Red Pill The most critical line in this entire page is the tag
...
As you probably already know, the ACTION attribute of the
tag specifies the name of the server−side script − "matrix.jsp" in this case − that will process the information entered into the form, while the METHOD attribute specifies the manner in which the information will be passed. The Last Action Hero 3 ... - tailieumienphi.vn
nguon tai.lieu . vn