Orion EJB Taglibrary

Deployment

1. Download the EJB Taglib here.

2. Put the EJB Taglib in your web applications WEB-INF/lib directory.

3. Reference the EJB Taglib in your web applications configuration file (web.xml) like this:

    <taglib>
      <taglib-uri>ejbtags</taglib-uri>
      <taglib-location>/WEB-INF/lib/ejbtags.jar</taglib-location>
    </taglib>

In your JSP, reference the taglib like this:

    <%@ taglib uri="ejbtags" prefix="ejb" %>

Overview

This tag-library contains general actions for interfacing with EJBs. It is free to use and redistribute.

<ejb:useHome id="String" type="String" location="String" />

Looks up a home

    id - the name to use for referencing the home interface. Accessable from start of tag to end of page
    type - the class of the home interface
    location - the lookup name of the home interface, as defined in the web.xml
    body - empty

Example usage:

    <ejb:useHome id="aomHome" type="com.acme.atm.ejb.AccountOwnerManagerHome" location="java:comp/env/ejb/accountOwnerManager" />

<ejb:useBean id="String" type="String" { value="<%=Object%>" } { scope="String" } >
... JSP ...
</ejb:useBean>

Looks up and narrows a bean.

    id - - the variable to use for referencing the bean
    type - the class of the bean
    value - EJBObject instance to narrow
    scope - a optional scope that the bean should be added to. Default is PAGE
    body - evaluated if the bean is not found

Example usage:

    <ejb:useBean id="bean" type="com.acme.MyBean" scope="session" />

<ejb:createBean instance="<%=Object%>" />

Creates a bean instance for useBean to use.

Must be used in the context of a useBean Tag.

    instance - a created EJBObject instance
    body - empty

Example usage:

    <ejb:useBean id="bean" type="com.acme.MyBean" scope="session">
      <ejb:createBean instance="<%=home.create()%>" />
    </ejb:useBean>

<ejb:iterate id="String" type="String" collection="<%=Collection%>" {max="<%=Integer%>"} >
... JSP ...
</ejb:iterate>

Iterates over the finder results from a home

    id - the variable to use for referencing the bean. Accessable inside the Tag
    type - the class of the bean
    collection - a collection of beans of the given type
    max - a optional maximum number of beans to iterate
    body - evaluated once for every bean in the collection

Example usage:

    <ejb:iterate id="account" type="com.acme.atm.ejb.Account" collection="<%=accountManager.getOwnerAccounts()%>" max="100">
      <jsp:getProperty name="account" property="id" />
    </ejb:iterate>

Suggestions can be sent to info@orionserver.com.