Navigation with Facelets template not working

跟風遠走 提交于 2019-12-01 17:41:33

This means that the request URL (as appears in browser address bar) didn't match the URL pattern of the FacesServlet as definied in web.xml.

Those links

<a href="ram.xhtml">RAM</a>
<a href="mobo.xhtml">Motherboard</a>
<a href="video.xhtml">Video Card</a>

expects the FacesServlet to be mapped on *.xhtml. But if it's mapped on for example *.jsf and changing it to *.xhtml is not an option for some reason (I however strongly recommend it), then you'd need to fix the links

<a href="ram.jsf">RAM</a>
<a href="mobo.jsf">Motherboard</a>
<a href="video.jsf">Video Card</a>

Or, better, just use <h:link>. It'll implicitly append the proper context path and FacesServlet mapping:

<h:link value="RAM" outcome="ram" />
<h:link value="Motherboard" outcome="mobo" />
<h:link value="Video Card" outcome="video" />

See also:

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