Java Reference
In-Depth Information
You can control many forEach properties. For instance, you can define a counter variable such as ctr (in the
Name property) or specify an increment value (i.e., the step property). However, to run a fixed number of iterations
only begin and end values are needed.
8.
In the Properties view, click on the Iterate fixed number of times radio button to select it.
9.
Specify 1 for the Begin value and 5 for the End value.
10.
Switch to the Source view.
Look at the simplicity of the tag syntax compared to the scriptlet—no semicolons, parentheses, braces, or variable
definitions! Are you a tag fan yet?
11.
Save the HowdyJSP source code and run on the server.
The results should look like Figure 9-4 .
Figure 9-4.
Tutorial: Enhancing the Web Application
Currently, our server-side application does not provide all the functions of the client-based application. For instance,
data entered by the user is never validated and there is no gross salary or tax calculation. This is because static Web
pages can't perform these types of functions. However, servlets and JSPs can.
We will add new fields to the Web page and then add/modify JSPs and servlets to provide the application
functions. We will then show how we can substitute a JSP (with tags) for the servlet.
Specifically, we are going to add an exemption drop-down menu and a function list box to EnterEmpInfoForm.
We will then create a servlet (called EmpServlet) to verify the data and determine which function to perform.
Then we will create three JSPs to display the employee information. Lastly, we will create a JSP with tags (called
EnterEmpInfoJSP) and show how a JSP can perform the function of the Web page (EnterEmpInfoForm) and servlet
(EmpServlet).
1.
Display EnterEmpInfoForm in the Design view.
Click File , Save As , and then specify the parent folder as TutorialsWeb/WebContent/c9.
2.
 
Search WWH ::




Custom Search