This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generate a mail with JSP?

 
Tim Storms
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic