有两个问题:
- 文件阅读器中的路径是实际路径,但我想要
relative path
从文件中读取内容后,我将该内容存储到一个字符串中,当我打印该字符串时,它不打印以下实际值
cn and ci
是代码。String content = ""; String cn, ci; cn = request.getParameter("carrier_name"); ci = request.getParameter("carrier_id"); BufferedReader in = new BufferedReader(new FileReader("C:\\Users\\abcd\\Documents\\NetBeansProjects\\sendmail\\web\\mailformat.html")); String str; while ((str = in.readLine()) != null) { content += str; } in.close(); out.println(""+content+"");
邮件格式.html
hello
carrier name :<label >"+cn+"</label>
carrier id <label>"+ci+"</label>