当前位置 : 主页 > 编程语言 > java >

jsp的class和beanName属性之间的区别:useBean

来源:互联网 收集:自由互联 发布时间:2021-06-25
jsp:classBean标记的class属性和beanName属性有什么区别. 刚阅读 the jsp:useBean documentation (page 35).这是相关的摘录: class="package.class" type="package.class" Instantiates a bean from the class named in class and
jsp:classBean标记的class属性和beanName属性有什么区别. 刚阅读 the <jsp:useBean> documentation (page 35).这是相关的摘录:

  • class="package.class" type="package.class"

    Instantiates a bean from the class named in class and assigns the bean the data type you specify in type. The value of type can be the same as class, a superclass of class, or an interface implemented by class.

    The class you specify in class must not be abstract and must have a public, no-argument constructor. The package and class names you use with both class and type are case sensitive.

  • beanName="{package.class | <%= expression %>}" type="package.class"

    Instantiates a bean from a class, a serialized template, or an expression that evaluates to a class or serialized template. When you use beanName, the bean is instantiated by the java.beans.Beans.instantiate method. The Beans.instantiate method checks whether the package and class you specify represents a class or a serialized template. If they represent a serialized template, Beans.instantiate reads the serialized form (which has a name like package.class.ser) using a class loader.

    The value of type can be the same as beanName, a superclass of beanName, or an interface implemented by beanName. The package and class names you use with both beanName and type are case sensitive.

网友评论