Java server pages for complex forms (lập TRÌNH WEB SLIDE)

27 20 0
Java server pages for complex forms (lập TRÌNH WEB SLIDE)

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Server-side Web Programming Lecture 4: Java Server Pages for Complex Forms Parsing Numeric Input • getParameter method returns a String This is “5”, not the number 5! • Must parse strings into numbers before performing numeric computations Parsing Numeric Input Useful built-in methods: • Parsing a whole number string (such as “57”): int Integer.parseInt(String) • Parsing a decimal string (such as “5.7”) double Double.parseDouble(String) • Example: String quantity = request.getParameter(“quantity”); int quantityNumber = Integer.parseInt(quantity); Numeric Input Example Order Confirmation

Thank you for your order of widgets, .

At $, your bill will be $.

You will shortly recieve an email confirmation at .

Numeric Input Example Complex Input Elements • Checkboxes • Radio Buttons • Lists • Require more complex handling – Will truly complex handling in multipage servlet structures Example Result Checkbox HTML • Basic form: Camera Scanner 20 List JSP • Sent in form …name= value… to server – peripherals=Camera – peripherals=Printer – peripherals=Scanner • Can access value using: String peripherals = request.getParameter("peripherals"); 21 Multiple Selection Lists • Can allow user to select multiple options from list with MULTIPLE attribute

Ngày đăng: 29/03/2021, 10:55

Mục lục

  • JSP for Multiple Selection Lists

  • Looping Through Arrays in JSP

  • Checking for NULL Lists

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan