Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Web Application Developer’s Guide phần 4 pot
MIỄN PHÍ
Số trang
25
Kích thước
707.4 KB
Định dạng
PDF
Lượt xem
944

Web Application Developer’s Guide phần 4 pot

Nội dung xem thử

Mô tả chi tiết

6-8 Web Application Developer ’ s Guide

Servlet wizard options

Figure 6.4 Servlet wizard - Filter servlet Naming Options page

Parameters page

The Parameters page of the Servlet wizard is where you enter servlet

parameters. Parameters are values passed to the servlet. The values might

be simple input values. However, they could also affect the runtime logic

of the servlet. For example, the user-entered value could determine what

database table gets displayed or updated. Alternatively, a user-entered

value could determine the servlet’s background color.

The servlet in Chapter 7, “Tutorial: Creating a simple servlet” uses a

parameter of type String to allow entry of the user’s name. The parameter

name in the SHTML file is UserName; the corresponding variable, used in

the servlet .java file is userName.

Figure 6.5 Servlet wizard - Parameters page

Creating servlets in JBuilder 6-9

Invoking servlets

Listener Servlet Details page

This page is available only if you’ve selected the servlet type of Listener

Servlet on the Naming and Type page of the Servlet wizard. It is Step 2,

and the final Servlet wizard step for listener servlets. You use this page to

implement one or more servlet listener interfaces. The corresponding

methods are added to the servlet.

The Servlet wizard automatically adds the selected listeners to the

Listeners section of the web.xml deployment descriptor file. For more

information, see “Listeners page” on page 16-8.

Figure 6.6 Servlet wizard - Listener Servlet Details page

Invoking servlets

The following topics discuss a few ways to invoke servlets:

• Invoking a servlet from a browser window

• Calling a servlet from an HTML page

Invoking a servlet from a browser window

A servlet can be called directly by typing its URL into a browser’s location

field. The general form of a servlet URL, where servlet-class-name

corresponds to the class name of the servlet, is:

http://machine-name:port-number/servlet/servlet-class-name

Tải ngay đi em, còn do dự, trời tối mất!