模板客户端在子目录中时获取java.io.FileNotFoundException

时间:2011-11-19 16:39:36

标签: templates jsf facelets filenotfoundexception

我正在尝试导航到一个管理页面,该页面在webcontent文件夹下有一个子目录,并且接收到java.io.FileNotFoundException。使用Glassfish 3.1.1。

我的

    war File:
         index.xhtml
         login.xhtml
         /admin/admin.xhtml

我正在使用的链接是:

       <h:link value="Admin" outcome="admin/admin.xhtml"/>

我希望隐式导航能够处理这个问题吗?

提前致谢,

斯科特

1 个答案:

答案 0 :(得分:4)

你的<h:link>看起来非常好,虽然我只是修剪.xhtml扩展名,以最大限度地减少样板和FacesServlet映射模糊,JSF已经为你解决了这个问题。

您需要读取您到达的FileNotFoundException消息。我的分数实际上指的是您在<ui:composition template>的{​​{1}}中使用的模板文件。您希望在其中指定绝对路径,即从admin/admin.xhtml开始,以便相对于网络内容的根目录进行解析,否则相对于当前模板客户端的位置。

E.g。因此所以:

/

会搜索<ui:composition template="WEB-INF/admintemplate.xhtml"> ,而是搜索:

/admin/WEB-INF/admintemplate.xhtml

请注意,这与隐式导航无关。直接打开页面时会遇到完全相同的问题。

相关问题