100+ câu trắc nghiệm Phát triển ứng dụng Web có đáp án - Phần 4

Giả sử đã có TimeBean như sau:public class TimeBean implements Serializable { private int hours, minutes, seconds; public TimeBean() {hours =minutes=seconds=0; } public int getHours(){return

7/27

GiảsửđãcóTimeBeannhưsau:

public class TimeBean implements Serializable { private int hours, minutes, seconds; public TimeBean() {hours =minutes=seconds=0; } public int getHours(){returnhours;}publicvoidsetHours(inth)if(h>=0&&h<24)hours=h;

}}HãychobiếtđoạnmãsautrongtrangJSPsẽ hiểnthịgìtrêntrìnhduyệt?

<jsp:useBeanid="TimeBean1"scope="request"class="JBean.TimeBean"/>

<jsp:getPropertyname="TimeBean1"property="hours"/>

0

Giờ hiện tại

24:00

Lỗi, không hiển thị gì

Giải thích

Chọn đáp án A