String content = MessageFormat.format("<a href=‘http://localhost:8080/bookstore/UserServlet?method=active&code={0}’>点击这里完成注册</a>",form.getCode());
当我使用上面这条语句时,code总为{0},也就是说占位符有问题,form.getcode(0)没有替换{0}
正确应这样写:
String content = MessageFormat.format("<a href=http://localhost:8080/bookstore/UserServlet?method=active&code={0}>点击这里完成注册</a>",form.getCode());
就是http前和{0}后不要有 ’ 这个符号
我感觉是,在字符串里的字符串使用占位符,是没法替换的