翻译 JAVA (2)正确者追加得分

来源:百度知道 编辑:UC知道 时间:2024/06/28 07:40:39
Using the managed-bean Element
You create a bean using a managed-bean element, which represents an instance of a bean class that must exist in the application. At runtime, the JavaServer Faces implementation processes the managed-bean element. If a page references the bean, the JavaServer Faces implementation instantiates the bean as specified by the element configuration if no instance exists.

Here is an example managed bean configuration from the Duke’s Bookstore application:

<managed-bean>
<managed-bean-name> NA </managed-bean-name>
<managed-bean-class>
com.sun.bookstore6.model.ImageArea
</managed-bean-class>
<managed-bean-scope> application </managed-bean-scope>
<managed-property>
<property-name>shape</property-name>
<value>poly</value>
</managed-property&g

managed-bean翻译成什么好呢?托管bean?受限bean?因为这个我不熟悉,所以你自己酌情看下吧。
********
使用受限Bean元素
(假如)你创建了一个使用受限bean元素的bean,就意味着你的应用程序中应该存在一个该Bean类的实例。在运行时,JSF会处理这些受限bean元素。如果某个页面引用了该Bean,JSF会按照元素配置实例化该bean,如果没有(相应的)的实例存在。

下面一个受限bean配置的例子,该例子来自Duke书店程序
使用Netbeans 集成开放环境,你可以按照下例步骤添加一个受限bean声明。
......代码.....
当在Netbeans中打开你的工程后,在工程窗格中展开工程中的节点
展开Web页和WEB-INF节点
双击face-config.xml
当face-config.xml文件在编辑器窗格打开后,右击编辑器窗格
选择JavaServer Faces → 添加受限Bean.
在“添加受限Bean对话框”中:
在Bean名称域(框)中键入Bean(显示的)名称
点击浏览以定位Bean类
在“类浏览对话框”中:
在类名框中输入你要寻找的类的名称,当你输入时,对话框会显示匹配的类
在匹配类框中选择(要找的)
点击OK
回到“添加受限Bean对话框”中:

在生命期菜单中选择bean的生命期
点击添加

在工程标签中,右击bookstore1工程,选择取消部属和部属

在先前的步骤中所添加的受限bean元素和3个元素有:
managed-bean-name, managed-bean-class managed-bean-scope
你需要在直接编辑配置XML文件以进一步对受限bean进行配置。

中文的学好了吗?要是看英文,就不能指望人家翻译