[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java template emailer



It might be easier for you not to use JSP to format the message.

It would be faster and simpler to just hold the HTML in some structure 
(giant StringBuffer, xml Document, etc.) and put the data in yourself. The 
problem with calling your JSP is that you'll be using a lot of processor 
cycles and network traffic just to do replacements for you.

You can do something like this:
have a map with all of your replacement variables and names for each user:
name="john"
email="x@x.x"
etc.

Then have a SringBuffer that contains this:
"Hello <%=name%> how are you? We are emailing you at <%=email%>...."

Then write a while loop to replace all the <%=%>'s with the values from the 
Map. It's very exensible, quick and doesn't require a JSP engine.

BAL


>From: "Chad Smith" <csmith@cimaconsulting.com>
>To: <ajug-members@www.ajug.org>
>Subject: java template emailer
>Date: Fri, 1 Mar 2002 09:35:23 -0500
>MIME-Version: 1.0
>Received: from [66.45.18.180] by hotmail.com (3.2) with ESMTP id 
>MHotMailBE48DD1800594136E80A422D12B481F20; Fri, 01 Mar 2002 06:37:24 -0800
>Received: (from list@localhost)by www.ajug.org (8.11.2/8.11.2) id 
>g21FgCm01959;Fri, 1 Mar 2002 10:42:12 -0500
>From ajug-members-request@ajug.org Fri, 01 Mar 2002 06:39:04 -0800
>Resent-Date: Fri, 1 Mar 2002 10:42:12 -0500
>Message-ID: <001f01c1c12e$53d5c720$7fcb98ac@gattaca>
>X-Priority: 3 (Normal)
>X-MSMail-Priority: Normal
>X-Mailer: Microsoft Outlook, Build 10.0.2616
>Importance: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
>In-Reply-To: <3C7F94B1.905842E2@pencom.com>
>Resent-Message-ID: <CeO-_.A.he.UF6f8@www>
>Resent-From: ajug-members@ajug.org
>X-Mailing-List: <ajug-members@ajug.org> archive/latest/3
>X-Loop: ajug-members@ajug.org
>List-Post: <mailto:ajug-members@ajug.org>
>List-Help: <mailto:ajug-members-request@ajug.org?subject=help>
>List-Subscribe: <mailto:ajug-members-request@ajug.org?subject=subscribe>
>List-Unsubscribe: 
><mailto:ajug-members-request@ajug.org?subject=unsubscribe>
>Precedence: list
>Resent-Sender: ajug-members-request@ajug.org
>
>
>I'm trying to create a marketing campaign emailer  for a client that
>will let me send out a template JSP file that i will populate with data
>from a data source.
>For example, I have a TreeSet of data where each index holds personal
>information about a user (name, email address, city, etc.)
>I want to send out an HTML/JSP email as follows:
>
>Hello <%=NAME%>,
>
>Thank you for purchasing <%=PRODUCT%>.
>Please let us know if you are satisfied with the product:
>
><HERE IS A DROPDOWNLIST>
>Very Satisfied
>Satisfied
>Not Satisfied
>You're Awful
><END LIST>
>
><SAVE>
>
>Now the problem i'm having is ...I know how to display this information
>for each person in the TreeSet (using a forward or include), but
>how do i send the completed jsp/html email to that person?
>
>  I know that I can do the following:
>
>URL thePage = new URL("http://www.yoursite.com/yourjsp.jsp";);
>URLConnection conn = thePage.openConnection();
>InputStream is = conn.getInputStream();
>
>  // read from this InputStream
>Then you can direct the data from that InputStream into the e-mail body.
>
>But i'm pretty sure this will send out the jsp without having first
>compiled it.
>I need to figure out a way to either compile the jsp and then send it,
>or compile it to some sort of .html file and send it.
>I also need to find the most efficient way of doing this since  the
>client could be sending large campaigns of emails.
>
>Thanks for your time!
>
>Chad Smith
>"May the road rise to meet you."
>




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.