File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Generate a mail with JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Generate a mail with JSP?" Watch "Generate a mail with JSP?" New topic

Generate a mail with JSP?

Tim Storms
Ranch Hand

Joined: Apr 27, 2006
Posts: 64
My Struts application generates a lot of mails. Currently, a mail assembler class takes care of their composing. But it's code is quite ugly. You'll get things like this:

I would like to have a cleaner way to generate the mails. Is there some kind of way to use a JSP page (with form bean content) which is somehow parsed to a HTML mail? Or maybe another better way?

Thanks for the suggestions!

SCJP 1.5, SCWCD 1.4, SCBCD 5
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
hi tim,

to my best knowledge and understanding this is not a struts specific problem. or, put it the other way round - your problem is not inherently covered by any special strut technology / approach.

sure you could develop a jsp which generates the mail text. then you can request and parse it in order to get the html-code.

actually i never thought about assembling mails this way, but sounds reasonable enough to give it a try.

i would have use ordinary pojo to build mails just as i need it, more or less the same then your StringBuilder idea.

a "enterprise" aproach might be to consider using a cms (content management system) which assembles the mail from its fragments. but that's a load of technology if you just have a few mails to generate.

hope it helps,
I agree. Here's the link:
subject: Generate a mail with JSP?
It's not a secret anymore!