Results 1 to 5 of 5
Like Tree2Likes
  • 2 Post By Tolls

Thread: How to send email using jsp page as a template using servlet?

  1. #1
    ayus is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Default How to send email using jsp page as a template using servlet?

    How can servlet use jsp page as a template to send email? Email content should be the jsp template sent by servlet
    Any code snippets would be really helpful. Thanks

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    28

    Default Re: How to send email using jsp page as a template using servlet?

    That's not what JSPs are intended for.
    Use a proper templating system like Velocity or FreeMarker.
    gimbal2 and ayus like this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    ayus is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Default Re: How to send email using jsp page as a template using servlet?

    Hi,

    I used Velocity template and my class extends to VelocityViewServlet.
    Everything is working fine but this servlet is rendering output to browser which i do not want. How can we just print the template in console.?

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    14

    Default Re: How to send email using jsp page as a template using servlet?

    Which console? Its a servlet and thus a web application, there is no console to speak of. If you want to do templating in another type of application you shouldn't be using a servlet of course, the only way to invoke those is by doing a HTTP request to the webserver in which it is deployed.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    28

    Default Re: How to send email using jsp page as a template using servlet?

    You said you wanted to produce something to email, so why are you trying to output it somewhere else?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 1
    Last Post: 11-14-2013, 10:29 AM
  2. How send Email in JSP page by java?
    By farshad in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-06-2012, 10:32 AM
  3. Replies: 0
    Last Post: 08-10-2010, 03:00 PM
  4. Replies: 0
    Last Post: 08-06-2010, 05:40 PM
  5. To send email of page present Web from a Jsp
    By Marcus in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 06-09-2007, 04:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •