记录HREF而不转义“小于”在Java中 [英] Logging an HREF without escaped "less than" in java
本文介绍了记录HREF而不转义“小于”在Java中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试过的方法to:
logger.info(< a href = \file:///+ screenshotFile.getAbsolutePath ()+\>屏幕截图< a>);
System.out.println(< a href = \file:///+ screenshotFile.getAbsolutePath()+\>截图< a>);
System.err.println(< a href = \file:///+ screenshotFile.getAbsolutePath()+\>截图< a>);
反正在输出中
<
总是作为& lt;
解决方案 <预>
//您的字符串
< / pre>
We are using selenium test triggered on a jenkins. As the attachment plugin for junit is for some reasons not working, I'd like to add html-references to screenshots of the test in the log.
The ways I tried to are:
logger.info("<a href=\"file:///" + screenshotFile.getAbsolutePath() + "\">Screenshot<a>");
System.out.println("<a href=\"file:///" + screenshotFile.getAbsolutePath() + "\">Screenshot<a>");
System.err.println("<a href=\"file:///" + screenshotFile.getAbsolutePath() + "\">Screenshot<a>");
In anyway in the output the
<
is always escaped as <
解决方案
This is commonly occurring problem, try to wrap the string with pre element.
<pre>
//your string
</pre>
这篇关于记录HREF而不转义“小于”在Java中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文