<ui:debug/> tag not working in Facelets (JSF 2.0)

梦想与她 提交于 2019-11-29 00:29:27

问题


I am doing a project using JSF 2.0 and Facelets.

I have read documentations that the <ui:debug/> tag gives valuable troubleshooting information upon pressing CTRL-SHIFT-D. But this never works for me. Please anyone tell me what am I missing.

(I tried with various hotkeys, still no success. eg: <ui:debug hotkey="a"/>)


回答1:


Ensure that you pick a key which isn't reserved by the webbrowser itself. In case of Firefox, a good choice is x.

<ui:debug hotkey="x" />

See also:

  • how to debug JSF/EL

Unrelated to the problem, I recommend to add a rendered attribute to ensure that it won't pop in a production environment. E.g.

<ui:debug hotkey="x" rendered="#{facesContext.application.projectStage == 'Development'}" />

in combination with this in web.xml

<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>



回答2:


I couldn't get it to work either until I placed the

<ui:debug hotkey="k" /> 

at the beginning of the TEMPLATE file, not the actual page. And I added the following to web.xml (but that was already mentioned):

<context-param>
    <description>
        Enables the ui:debug facelets tag.
    </description>
    <param-name>javax.faces.FACELETS_DEVELOPMENT</param-name>
    <param-value>true</param-value>
</context-param>

Sorry for the late answer, but I got it to work like this on Firefox 3. I don't think it's your popup blocker. The debug popup will usually get blocked, but you'll get a notification (as did I).




回答3:


One more way:

Add the following to web.xml

<context-param>
  <param-name>javax.faces.DEVELOPMENT</param-name>
  <param-value>Development</param-value>
</context-param>

And add <ui:debug hotkey="k"/> to HTML part of template (not necessarily to the beginning)



来源:https://stackoverflow.com/questions/4049531/uidebug-tag-not-working-in-facelets-jsf-2-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!