String htmlFileName = UUIDUtil.generateUUID()+".html"
String htmlPath = imgPath+ File.separatorChar+htmlFileName
File file2 = new File(htmlPath)
StringBuilder sb = new StringBuilder()
try {
file2.createNewFile()//创建文件
sb.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/htmlcharset=utf-8\"><title>Html Test</title></head><body>")
sb.append("<div>")
sb.append(text)
sb.append("</div>")
sb.append("</body></html>")
PrintStream printStream = new PrintStream(new FileOutputStream(file2))
printStream.println(sb.toString())//将字符串写入文件
} catch (IOException e) {
code = 0
e.printStackTrace()
}
<body><div id="mydiv"></div>
<script type="text/javascript">
document.getElementById("mydiv").innerHTML = "<s:property value='message.message'/> "
</script>
<s:debug/>
</body>
试试,希望能帮助你。
试试 document.write("<a href='#'></a>")至于你那个字符串怎么来的就怎么来然后放入这个docment.write中试试或者用jQuery 实现 $("#xxx").html("你的字符串html标签")欢迎分享,转载请注明来源:内存溢出
评论列表(0条)