zoukankan      html  css  js  c++  java
  • Hello.java分析

    Double-click the Hello.java file to view it.

    The Hello class, called a managed bean class, provides getter and setter methods for the name property used in the Facelets page expressions. By default, the expression language refers to the class name, with the first letter in lowercase (hello.name).

    package javaeetutorial.hello1;
    
    import javax.enterprise.context.RequestScoped;
    import javax.inject.Named;
    
    @Named
    @RequestScoped
    public class Hello {
    
        private String name;
    
        public Hello() {
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String user_name) {
            this.name = user_name;
        }
    }

    If you use the default name for the bean class, you can specify @Model as the annotation instead of having to specify both @Named and @RequestScoped. The @Model annotation is called a stereotype, a term for an annotation that encapsulates other annotations. It is described later in Using Stereotypes in CDI Applications. Some examples will use @Model where it is appropriate.

    译文:

    双击该Hello.java文件以查看它。

    Hello类,称为管理bean类,提供了getter和setter方法name中的Facelets页面表达式中使用属性。默认情况下,表达式语言引用类名,第一个字母为小写(hello.name)。

    package javaeetutorial.hello1;
    
    import javax.enterprise.context.RequestScoped;
    import javax.inject.Named;
    
    @Named
    @RequestScoped
    public class Hello {
    
        private String name;
    
        public Hello() {
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String user_name) {
            this.name = user_name;
        }
    }

    如果使用bean类的默认名称,则可以指定@Model 为注释,而不必指定两者@Named和 @RequestScoped。该@Model注释称为刻板印象,是用于封装其他注释的注释术语。稍后将在CDI应用程序使用定型。一些示例将使用@Model适当的地方。

  • 相关阅读:
    朴素贝叶斯分类算法原理
    DevExpress控件学习总结
    Nginx + Tomcat 配置负载均衡集群
    DotNet Core全新认识
    为何梯度反方向是函数值下降最快的方向
    理解矩阵
    C#版-Redis缓存服务器在Windows下的使用
    文本情感分类:分词 OR 不分词(3)
    文本情感分类:深度学习模型(2)
    文本情感分类:传统模型(1)
  • 原文地址:https://www.cnblogs.com/hcwys/p/8692428.html
Copyright © 2011-2022 走看看