Java Reference
In-Depth Information
With this annotation, we can now define and use objects of Session type as in the
case of the following code which is an example to show how to use @MailSes-
sionDefinition :
name = "java:app/env/MyMailSession",
transportProtocol = "SMTP",
user = "",
password = "user_password"
@WebServlet(name = "MailSenderServlet")
public class MailSenderServlet extends
HttpServlet {
Session session;
public void doPost(HttpServletRequest
request, HttpServletResponse response)
throws IOException, ServletException {
While the @MailSessionDefinition annotation allows us to define MailSes-
sion , @MailSessionDefinitions annotation allows us to configure many
MailSession instances. The following code shows how to define two MailSes-
sion using instances @MailSessionDefinitions at a time:
{ @MailSessionDefinition(name = "java:/
@MailSessionDefinition(name = "java:/en/
...") }
Search WWH ::

Custom Search