【发布时间】:2023-03-10 19:38:01
【问题描述】:
我正在使用 jsf 2.0 创建 Web 应用程序。我有命令按钮,样式如下。
我拥有的是
style="#{patentInfo.photoType.contains('application')?'visibility:visible;background-image: url(DisplayImage?mainID=tempo1;id=1)':'visibility:hidden;'
在 DisplayImage.java 下面是我所拥有的
String mainID = request.getParameter("mainID");
String whatString = request.getParameter("id");
System.out.println("mainID=="+mainID+", whatString=="+whatString);
我期待的输出是
mainID==tempo1, whatString==1
但是我得到它
mainID==tempo1;id=1, whatString==null
^^^^^
这意味着我需要在 url(DisplayImage?mainID=tempo1;id=1) 之后使用第三个分隔符,例如 ", '
即像
url(@DisplayImage?mainID=tempo1;id=1@)
^ ^
只是好奇,我们有像倒逗号这样的第三级分隔符吗?
请建议我该怎么做?
编辑 1
如果我像下面这样使用,它可以完美地工作,因为我只使用了 2 个级别作为 " 和 '。
style="background-image: url('DisplayImage?mainID=tempo1;id=1')"
我需要第三级的解决方案。
【问题讨论】:
-
我很好奇,为什么
&不能在这里用作参数分隔符(而不是;)? -
@raina77ow : 你的意思是
url(DisplayImage?mainID=tempo1&id=1)?? -
@raina77ow — 谁说不能?
-
@Quentin 好吧,不知何故 OP 没有使用它,因此我的问题。 )
-
@raina77ow :这给了我
The reference to entity "id" must end with the ';' delimiter.的错误。即使我使用url(DisplayImage?mainID=tempo1&id=1;),我也会遇到同样的错误。
标签: java html css jsf-2 styles