EJB3的XML Schema第十四讲

result-type-mappingType 用在query 元素中来指定由选择方法的查询返回的抽象schema 类型是否被映射到EJBLocalObject 或EJBObject 类型。
它的值必须是Local 或Remote。
</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:restriction base="javaee:string">
<xsd:enumeration value="Local"/>
<xsd:enumeration value="Remote"/>
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
<!-- **************************************************** -->
<xsd:complexType name="security-identityType">
<xsd:annotation>
<xsd:documentation>
security-identityType 指定了调用者的安全标识是否用于企业bean 方法的执行,或者是否使用run-as 标识。它包含一个可选的安全标识的描述和规范。
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="description" type="javaee:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:choice>
<xsd:element name="use-caller-identity" type="javaee:emptyType">
<xsd:annotation>
<xsd:documentation>
use-caller-identity 元素指定了调用者的安全标识用作企业bean 方法执行的安全标识。
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="run-as" type="javaee:run-asType"/>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"/>
</xsd:complexType>
<xsd:complexType name="session-beanType">
<xsd:annotation>
<xsd:documentation>
session-beanType 声明会话bean。这个声明包括:
- 一个可选的描述。
- 一个可选的显示名称。
- 可选的图标元素,这个元素包含了一个小的和大的图标文件名。
- 一个分配到部署描述中企业bean 的唯一名称。
- 一个可选的mapped-name 元素,它可以被用于提供供应商特有的部署信息,
例如会话bean 的远程home/业务接口的物理jndi-name。这个元素不要求所有的实现都支持它。使用这个元素的应用都是不可移植的。
- 所有远程或本地业务接口的名称,如果有的话。
- 会话bean 的远程home 核remote 接口的名称,如果有的话。
- 会话bean 本地home 和local 接口的名称,如果有的话。
- 会话bean 的web 服务终端接口的名称,如果有的话。
- 会话bean 的实现类。
- 会话bean 的状态管理类型。
- 可选的bean 的超时方法的声明。
- 可选的会话bean 的事务管理类型。如果没有定义,则缺省是Container。
- 可选的会话bean 类和/或超类的around-invoke 方法列表.
- 可选的bean 的环境条目的声明。
- 可选的bean 的EJB 引用的声明。
- 可选的bean 的本地EJB 引用的声明。
- 可选的bean 的web 服务引用的声明。
- 可选的安全角色引用声明。
- 可选的用于bean 方法执行的安全标识声明。
- 可选的bean 的资源管理器连接工厂引用声明。
- 可选的bean 的资源环境引用声明
- 可选的bean 的消息目的地引用声明。
如果可选的元素没有被指定,则忽略它们。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面是web.xml文件和ejb-jar.xml文件的基本结构示例: web.xml文件示例: ```xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <servlet> <servlet-name>HelloServlet</servlet-name> <servlet-class>com.example.HelloServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloServlet</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> <listener> <listener-class>com.example.MyServletContextListener</listener-class> </listener> <error-page> <error-code>404</error-code> <location>/error404.jsp</location> </error-page> </web-app> ``` ejb-jar.xml文件示例: ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <enterprise-beans> <session> <ejb-name>HelloEJB</ejb-name> <home>com.example.HelloEJBHome</home> <remote>com.example.HelloEJB</remote> <ejb-class>com.example.HelloEJBBean</ejb-class> </session> </enterprise-beans> </ejb-jar> ``` 在这两个示例中,web.xml文件定义了一个Servlet、Servlet映射、ServletContextListener和错误页面,而ejb-jar.xml文件定义了一个Session Bean。在实际开发中,这些文件中的具体内容会根据项目需要进行更改和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值