The jsp:useBean associates a JavaBean with the JSP and ensures that the object is available for the scope specified in the tag. The bound object can be referenced using the associated id from one or more JSPs (depending on the scope). The tag syntax is as follows: <jsp:useBean id="name" scope="page|request|session|application" beandetails /> Where beandetails is one of: class="className" class="className" type="typeName" beanName="beanName" type="typeName" type="typeName" Using the "Hello World" example, if you assume there is a HelloWorld Bean to act as the interface to the JPO, then you might find the following usage in a JSP: <jsp:useBean id="helloBean" scope="session" class="HelloWorld" /> <html> <body> <% helloBean.hello(); %> </body> </html> This shows a HelloWorld Bean being defined and given an id of "helloBean". The hello() method simply calls the JPO to generate the "Hello World!" text. public class HelloWorld implements Serializable { public HelloWorld () { } public void hello() { String[] init = new String[] {}; String[] args = new String[] {}; // establish a context ? <details not shown> int status = JPO.invoke(context, "Hello World", init, "mxMain", args); } } |