JSF 2.3.14:(重新)呈现JavaScript代码块(常数)之后的语法错误
当我按下h:commandbutton
:
<h:outputScript>
'use strict';
const label = '*';
</h:outputScript>
<h:form>
<h:commandButton>
<f:ajax render="@all" />
</h:commandButton>
</h:form>
syntaxerror:const Label label
问题是,问题是const label ='*'*'*'*'*'*
。在这种情况下如何处理?
Mojarra 2.3.14
The following code fragment generates a javascript syntax error when I push the h:commandButton
:
<h:outputScript>
'use strict';
const label = '*';
</h:outputScript>
<h:form>
<h:commandButton>
<f:ajax render="@all" />
</h:commandButton>
</h:form>
SyntaxError: redeclaration of const label
The problem is the const label = '*'
. How to deal with that in this case?
Mojarra 2.3.14
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以基于
faceScontext.postback
进行h:outputscript
条件。如果您使用rendered =“#{不facescontext.postback}”
它只会在初始请求中渲染,而不是在AJAX请求中渲染:另请参见:
You can make the
h:outputScript
conditional, based onfacesContext.postback
. If you userendered="#{not facesContext.postback}"
it will only be rendered in the initial request and not with Ajax requests:See also: