René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Using beans in JSP | ||
<jsp:useBean><jsp:useBean> loads a java bean into a JSP page.
<jsp:useBean id="some_identifier" class="Foo.class" />
The name specified with id (here: some_identifier) is a name of a variable to wich a new instance of the class will be bound. An equivalent for the
statement would be:
<% Foo some_identifier=new Foo(); %>
This is among the reasons why a EJB must have a zero argument constructor.
<jsp:getProperty><jsp:getProperty name="some_identifier" property="SomeProperty" />
This is of course equivalent to
<% some_identifier.getSomeProperty(); %> <jsp:setProperty><jsp:setProperty name="some_identifier" property="SomeProperty" value="Some new value" /> |