Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7520889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:08:43+00:00 2026-05-30T02:08:43+00:00

I need to implement email confirmation in my java web application. I am stuck

  • 0

I need to implement email confirmation in my java web application. I am stuck with the email I have to send to the user.

I need to combine a template (of an confirmation email) with the User object and this will be the html content of the confirmation email.
I thought about using xslt as the template engine but I don’t have xml form of the User object and don’t really know how to create a xml from User instance.
I thought about jsp, but how do I render jsp page with an object and get the html as a result?

Any idea what packages I can use in order to create templae and combine it with an object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:08:44+00:00Added an answer on May 30, 2026 at 2:08 am

    Instead of learning a new code, debug other’s complicate code I decided to write my own small and suitable util:

    public class StringTemplate {
        private String filePath;
        private String charsetName;
        private Collection<AbstractMap.SimpleEntry<String, String>> args;
    
        public StringTemplate(String filePath, String charsetName,
                              Collection<AbstractMap.SimpleEntry<String, String>> args) {
            this.filePath = filePath;
            this.charsetName=charsetName;
            this.args = args;
        }
    
        public String generate() throws FileNotFoundException, IOException {
            StringBuilder builder = new StringBuilder();
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    getClass().getResourceAsStream(filePath),charsetName));
            try {
                String line = null;
    
                while ((line = reader.readLine()) != null) {
                    builder.append(line);
                    builder.append(System.getProperty("line.separator"));
                }
            } finally {
                reader.close();
            }
            for (AbstractMap.SimpleEntry<String, String> arg : this.args) {
                int index = builder.indexOf(arg.getKey());
                while (index != -1) {
                    builder.replace(index, index + arg.getKey().length(), arg.getValue());
                    index += arg.getValue().length();
                    index = builder.indexOf(arg.getKey(), index);
                }
            }
            return builder.toString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django-based web application that is required to send a confirmation email
I have a very complex system (100+ threads) which need to send email without
I need some idea to implement the following requirement in the web application .
I have to implement a ListView with elements from a Person object. This object
Need a few infos please regarding the communication of a Java web application via
I need to implement the web application for sending marketing emails to the partners
I need to implement an automated email reply system. Here for the system i
Possible Duplicate: What is the best Java email address validation method? I need to
I need to implement the common 'New Account' pattern (in .net MVC) where: user
I need to send newsletters. I have already a PHP script that sends mass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.