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适当的地方。

  • 相关阅读:
    CodeForces 697B Barnicle 模拟
    15.三数之和
    167.两数之和
    209.长度最小子数组-sliding window
    COMP9313 Week9a-0
    树总纲(To be continued)
    COMP9517 Week8
    COMP9313 week8b Pipeline
    94. 二叉树的中序遍历
    COMP9313 Week8 Classification and PySpark MLlib
  • 原文地址:https://www.cnblogs.com/WeVv/p/8692409.html
Copyright © 2011-2022 走看看