css样式不适用于复合组件

时间:2013-11-30 13:02:41

标签: html css jsf

我希望composite:implementation标记中声明的表单在中心对齐。我写了下面的代码:

网页/资源/ ccomp / cco.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:composite="http://java.sun.com/jsf/composite">
    <h:head>
        <h:outputStylesheet library="css" name="newcss.css"/>
    </h:head>
    <composite:interface>
    </composite:interface>
    <composite:implementation>
             <h:form id="formdiv">
                <h:outputLabel value="Text"/>
                <h:inputText validator="#{loBean.validateL}"/>
            </h:form>
    </composite:implementation>
</html>

网页/资源/ css / newcss.css

#formdiv {
    width: 30%;
    margin: 150px auto;
    color: green;

}

网页/ index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:lpform="http://xmlns.jcp.org/jsf/composite/lpform"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <h:head>
        <h:outputStylesheet library="css" name="newcss.css"/>
    </h:head>
    <form>
        <ccomp:cco id="formdiv"/>
    </form>
</html>

但它不起作用。当我部署并运行此app复合组件时,找到左上角。

0 个答案:

没有答案