gpt4 book ai didi

jsp - jsp :useBean 的 class 和 beanName 属性的区别

转载 作者:行者123 更新时间:2023-12-04 03:26:39 28 4
gpt4 key购买 nike

class 标签的 beanName 属性和 jsp:useBean 属性有什么区别。

最佳答案

只需阅读 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.

关于jsp - jsp :useBean 的 class 和 beanName 属性的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8710733/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com