Home  >  Q&A  >  body text

JavaBean问题?

下列关于JavaBean的说法正确的是:( )
A Java文件与Bean所定义的类名可以不同,但一定要注意区分字母的大小写
B 在JSP文件中引用Bean,其实就是用<jsp:useBean>语句
C 被引用的Bean文件的文件名后缀为.java
D Bean文件放在任何目录下都可以被引用

A是什么意思?
B为什么错了?

PHP中文网PHP中文网2715 days ago740

reply all(3)I'll reply

  • 高洛峰

    高洛峰2017-04-17 17:57:23

    A Bean is essentially a java class, so the public class name and file name must be the same
    B <jsp:useBean> declares a bean, not a reference, see the description here
    C Yes, a bean is a type of java class , the file name suffix of the java class is java
    D Any is definitely wrong. If you put it on someone else’s computer, you can’t quote it, at least not directly

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:57:23

    This kind of question is really boring. It's either wordy or vague. I guess the person who asked the question is also half-assed.

    1. What is the class name defined by Bean? Can Bean define a class?

    2. It seems to be correct, but the premise is that the corresponding java class must be in the class path, but does this have anything to do with java beans?

    3. The file suffix is ​​just an appearance. What if I change .class to .java and then use classLoader to load the file?

    4. If I write a custom ClassLoader and scan all directories, won’t the beans be loaded in? What is referencing a bean file?

    reply
    0
  • 迷茫

    迷茫2017-04-17 17:57:23

    Don’t worry too much when you encounter a question with unclear language. The person who asked the question didn’t even understand it himself...

    reply
    0
  • Cancelreply