2011-10-11 75 views

回答

7

并非如此,但引用URL资源的所有JSF组件都已自动包含适当的上下文路径,并最终还会映射到映射。例如,<h:link>

<h:link value="Link to other page" outcome="otherpage" /> 

这使得类似的东西(假设你的上下文路径是/contextname和你FacesServlet被映射在*.xhtml):

<a href="/contextname/otherpage.xhtml">Link to other page</a> 

您可以通过<f:param>包括请求参数:

<h:link value="Link to other page" outcome="otherpage"> 
    <f:param name="foo" value="#{bean.foo}" /> 
</h:link> 

它呈现类似于:

<a href="/contextname/otherpage.xhtml?foo=bar">Link to other page</a> 

其他链接部件也做是<h:outputStylesheet><h:outputScript><h:graphicImage>对CSS,分别JS和图像:

<h:outputStylesheet library="default" name="css/foo.css" /> 
<h:outputScript library="default" name="js/foo.js" /> 
<h:graphicImage library="default" name="images/foo.png" /> 

这使得类似:

<link rel="stylesheet" type="text/css" href="/contextname/javax.faces.resource/css/foo.css.xhtml?ln=default" /> 
<script type="text/javascript" src="/contextname/javax.faces.resource/js/foo.js.xhtml?ln=default"></script> 
<img src="/contextname/javax.faces.resource/images/foo.png.xhtml?ln=default" /> 
+0

好的,谢谢......正是我需要的! –

+0

不客气。 – BalusC

相关问题