两者的API如下:
abstract public Object getAttribute(String name)
返回与页面范围中的名称关联的对象,如果该对象不存在,则返回 null。 name 要获取的属性的名称
return 与页面范围中的名称关联的对象,如果该对象不存在,则返回 null。
Throws NullPointerException: 如果名称为 null。
英文文档:
getAttribute
public abstract Object getAttribute(String name)Returns the object associated with
the name in the page scope or null if not found.
Parameters:
name - the name of the attribute to get
Returns:
the object associated with the name in the page scope or null if not found.
Throws:
NullPointerException - if the name is null
abstract public Object findAttribute(String name)
按顺序在页面、请求、会话(如果有效)和应用程序范围中搜索指定属性,并返回关联的值或 null。
name 要搜索的属性的名称
return 关联的值或 null
Throws NullPointerException: 如果名称为 null。
英文文档:
findAttribute
public abstract Object findAttribute(String name)Searches for the named attribute in
page, request, session (if valid), and application scope(s) in order and returns the
value associated or null.
Parameters:
name - the name of the attribute to search for
Returns:
the value associated or null
Throws:
NullPointerException - if the name is null