【问题标题】:3rd level of inverted comma (didn't get proper title)第三级逗号(没有得到正确的标题)
【发布时间】: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


【解决方案1】:

URL 参数分隔符为?&。 你可以使用url(DisplayImage?mainID=tempo1&id=1)

【讨论】:

  • 这给了我The reference to entity "id" must end with the ';' delimiter.的错误。即使我使用url(DisplayImage?mainID=tempo1&id=1;),我也会遇到同样的错误。
  • 如果您将& 放入HTML 或XML 中,那么它应该表示为&(因为& 表示“实体的开始”)
  • @Quentin 没错。 ) 并且错误消息本身很清楚地给出了它(因为 XML 实体以 '&' 开头并以 ';' 结尾)
猜你喜欢
  • 2013-03-01
  • 2021-04-14
  • 1970-01-01
  • 1970-01-01
  • 2013-07-25
  • 1970-01-01
  • 2017-01-03
  • 1970-01-01
相关资源
最近更新 更多