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
posted 9 years ago
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.