Choose File> New...> Web> double-click the JSP icon to bring up the create JSP wizard dialog box, as shown in the following figure:
Figure 3 create login. jsp using the wizard
· Web module: If a project contains multiple Web modules, you can specify the Web module to which JSP is to be added here, because our project only has one webModule, therefore, the wizard sets the default value to webModule.
· Name: Enter the JSP file Name. You can enter a. jsp suffix, or enter login without a suffix.
After the Generate sample bean option is selected, JBuilder will Generate a sample Bean and introduce this Bean in JSP. For beginners, you can use this option to view how JSP references a Bean, while the Generate error page option will automatically create a matching error handling JSP file for JSP. Here, we do not select them.
Click Finish to create login. jsp. The login. jsp file appears in the content pane compiler, as shown in the following figure:
Figure 4 JSP file created by the wizard
There is a vertical bar that can be controlled by the button on both sides of the JSP compilation window. The left bar is the panel for placing JSP labels and HTML labels, various labels can be dragged to the JSP file like in the visual uidesigner. As shown in the figure above, we select the HTML tag of the form from the panel and place it in login. jsp file.
In the vertical bar on the right is the property compiler of the tag where the current cursor is located in the JSP file, as shown in the following figure:
Figure 5 set the JSP tag attribute editor
The property editor is dynamic. When the cursor moves to different labels, the property editor displays all the attributes that can be set for this label. In the preceding figure, the attribute editor of the HTML form tag is used. We set the action attribute to switch. jsp and specify the POST method to send request data.
In login. jsp, we provide a user name drop-down box, a password input box, and a logon submission button. The code is as follows:
Code List 4 login. jsp
1. <% @ page contentType = "text/html; charset = GBK" %>
2. 3. 4. <title> login </title>
5. 6. <body bgcolor = "# ffffff">
7. <form name = "form 1" method = "post" action = "switch. jsp">
8. Username: <select name = "userId">
9. <option value = "" selected> -- logon user -- </option>
10. <option value = "100000"> Jiang Ziya </option>
11. <option value = "100001"> Bao Shuya </option>
12. <option value = "100002"> vertical teeth </option>
13. </select>
14. password: <input name = "password" type = "password">
15. <input type = "submit" name = "Submit" value = "logon">
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.