I have two xhtml-s, one including the other. My problem is that parameter passing is not working for me:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/开发者_如何学C1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component" >
<ui:include src="core-classic-layout.xhtml">
<ui:param name="css-basename" value="core-classic"></ui:param>
<ui:param name="css-themename" value="blue"></ui:param>
</ui:include>
</html>
and the other core-classic-layout.xhtml is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component" >
<f:view locale="#{system.usedLocale}" >
<ice:loadBundle
basename="hu.gap.resources.messages"
var="msgs"/>
<head>
<title>#{msgs['ApplFrmTitle']}</title>
<ice:outputStyle href="./xmlhttp/css/rime/rime.css" />
<ice:outputStyle href="./xmlhttp/css/core/#{css-basename}-layout.css" />
<ice:outputStyle href="./xmlhttp/css/core/#{css-basename}-#{css-themename}.css" />
</head>
My problem is that the browser tries to load 0-layout.css ant 0-0.css files, when I navigate to the first xhtml that includes the second one.
"-" is an arithmetic operator, so when you write css-basename
it is css minus basename
, it evaluates to 0. Calling the param cssBaseName will solve it.
This will implicitly include the layouts anywhere you include core-classic-layout.xhtml.
<ice:outputStyle href="./xmlhttp/css/core/#{css-basename}-layout.css" />
<ice:outputStyle href="./xmlhttp/css/core/#{css-basename}-#{css-themename}.css" />
You can just remove the layouts from core-classic-layout.xhtml if you don't want them loaded.
精彩评论