
Action
tag
There
are three main roles of action tags :
1)
enable
the use of server side Javabeans
2)
transfer
control between pages
3)
browser
independent support for applets.
Javabeans
A
Javabean is a special type of class that has a number of
methods. The JSP page can call these methods so can leave most
of the code in these Javabeans. For example, if you wanted to
make a feedback form that automatically sent out an email. By
having a JSP page with a form, when the visitor presses the
submit button this sends the details to a Javabean that sends
out the email. This way there would be no code in the JSP page
dealing with sending emails (JavaMail API) and your Javabean
could be used in another page (promoting reuse).
To
use a Javabean in a JSP page use the following syntax:
<jsp
: usebean id = “ …. “ scope = “application” class =
“com…” />
The following is a list of Javabean scopes:
page – valid until page completes.
request – bean instance lasts for the client request
session – bean lasts for the client session.
application – bean instance created and lasts until
application ends.
|