Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java &引用;错误的参数语法“;使用MessageFormat_Java_Html_Messageformat - Fatal编程技术网

Java &引用;错误的参数语法“;使用MessageFormat

Java &引用;错误的参数语法“;使用MessageFormat,java,html,messageformat,Java,Html,Messageformat,我得到了这个html语法,它是在MessageFormat的帮助下填充的: private final String WRAPPABLE_HTML = "<html><head>" + "<style>div:after{text-decoration: line-through;}" + "</style></head>" + "<body style='width:{0}px;m

我得到了这个
html
语法,它是在
MessageFormat
的帮助下填充的:

private final String WRAPPABLE_HTML = "<html><head>"
        + "<style>div:after{text-decoration: line-through;}"
        + "</style></head>"
        + "<body style='width:{0}px;margin: 0 auto;'><div>{1}</div>{2}</body></html>";
我得到:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Bad argument syntax: text-decoration: lin ...
at com.ibm.icu.text.MessagePattern.parseArg(MessagePattern.java:1106)
at com.ibm.icu.text.MessagePattern.parseMessage(MessagePattern.java:1042)
没有
样式
部分,一切正常。 我是否在
样式
属性中使用了任何
关键字

谢谢你的帮助


Stefan

你应该避开花括号:

private final String WRAPPABLE_HTML = "<html><head>"
        + "<style>div:after'{'text-decoration: line-through;'{'"
                            ^                                ^
        + "</style></head>"
        + "<body style='width:{0}px;margin: 0 auto;'><div>{1}</div>{2}</body></html>";
private final String WRAPPABLE_HTML=“”
+div:after'{'text-decoration:line-through;'{'
^                                ^
+ ""
+ "{1}{2}";

您可能应该避开style标签中的花括号。好的,就是这样!非常感谢!如果您将其作为答案发布,我将接受它。。。
private final String WRAPPABLE_HTML = "<html><head>"
        + "<style>div:after'{'text-decoration: line-through;'{'"
                            ^                                ^
        + "</style></head>"
        + "<body style='width:{0}px;margin: 0 auto;'><div>{1}</div>{2}</body></html>";