<document>
<localtoc/> <s1>

With Resin, applications can use JAXB to configure its resources directly from the resin.conf or resin-web.xml. A "JAXB Bean" is just a Java class that follows a simple set of rules. Each configuration parameter foo has a corresponding setter method `setFoo` with a single argument for the value. Resin can look at the class using Java's reflection and find the `setFoo` method. Because Resin can find the bean-style setters from looking at the class, it can configure those setters in a configuration file like the resin-web.xml.

</s1> <deftable>
Configures the bean with JAXB init
Theater model
Movie model
The servlet implementation.
</deftable>

The <bean> tag creates a singleton component for the Theater, which can be used by any servlet, JSP, JSF, EJB or WebBeans component by using the WebBeans injection annotations..

<web-app xmlns="http://caucho.com/ns/resin"> <bean name="beans/theater" class="example.Theater"> <init> <name>Balboa Theater</name> <movie> <title>Plan 9 from Outer Space</title> </movie> <movie> <title>Snakes on a Plane</title> <star>Samuel L Jackson</star> </movie> <movie> <title>The Maltese Falcon</title> <star>Humphrey Bogart</star> <star>Mary Astor</star> <star>Peter Lorre</star> <star>Sydney Greenstreet</star> </movie> </init> </bean> <servlet-mapping url-pattern="/test" servlet-class="example.TestServlet"/> </web-app> package example; import java.util.*; import javax.xml.bind.annotation.*; @XmlRootElement public class Theater { @XmlElement(name="name") private String _name; @XmlElement(name="movie") private ArrayList<Movie> _movieList = new ArrayList<Movie>(); } package example; import java.util.*; import javax.xml.bind.annotation.*; @XmlRootElement public class Movie { @XmlElement(name="title") private String _title; @XmlElement(name="star") private ArrayList<String> _starList = new ArrayList<String>(); } package example; import javax.servlet.*; import javax.webbeans.In; public class TestServlet extends GenericServlet { @In private Theater _theater; ... }
</document>