Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = ';'

场景:邮件发送带html格式,利用%s带入参数到html中组成邮件内容串

错误:Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = ';'

原代码:

String templateStr ="\n"
            + "\n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  邮件样式\n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "\n"
            + "\n"
            + "  
\n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "
老师,您好:
\n" + "
\n" + " \n" + "
预检结果
\n" + " \n" + "
\n" + "
\n" + "

上海百事通信息技术股份有限公司

\n" + "

%s

\n" + "
\n" + "
\n" + "\n" + "";

修改过后的html的string串:

String templateStr ="\n"
            + "\n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  邮件样式\n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "  \n"
            + "\n"
            + "\n"
            + "  
\n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "
老师,您好:
\n" + "
\n" + " \n" + "
预检结果
\n" + " \n" + "
\n" + "
\n" + "

上海百事通信息技术股份有限公司

\n" + "

%s

\n" + "
\n" + "
\n" + "\n" + "";

区别:

修改之后:

Exception in thread

修改之前:

Exception in thread

 

你可能感兴趣的:(Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = ';')