将jsf.js.jsf重命名为jsf.js.xhtml

问题描述:

xhtml页面包含

<script src="/javax.faces.resource/jsf.js.jsf?ln=javax.faces&amp;stage=Development" type="text/javascript"></script>

如果我删除了脚本,则javascript函数无法正常工作. 要求是仅支持.xhtml页面.因此,我继续进行操作,并删除了web.xml中.jsf的servlet映射,这导致javascript函数执行不正确.

If I remove the scripts the javascript functions do not work as expected. The requirement is to support only .xhtml pages. So, I went ahead and removed servlet-mapping for .jsf in web.xml, which results in javascript functions being executed incorrectly.

那么,我们可以将jsf.js.jsf更改为jsf.js.xhtml吗?

So, can we change jsf.js.jsf to jsf.js.xhtml?

如果您正确使用<h:head>而不是<head>,则应该自动完成.您完全不应将jsf.js手动包含在<script>中.将主模板中的<head>固定为<h:head>,并从Facelet模板中删除所有引用jsf.js<script>行.

That should be done automatically if you're properly using <h:head> instead of <head>. You should not manually include the jsf.js in a <script> at all. Fix the <head> in your master template to be <h:head> and remove all those <script> lines referring jsf.js from your Facelet templates.