0

I have tried calling the CSS in every way possible but nothing works. Here are four different ways... While I was making tests, I duplicated the style.css file , so there is one in the same folder as the XML code, and there is one in the CSS folder. Both have the same content.

<?xml version='1.0' encoding='UTF-8' ?>
<!-- <h:outputStylesheet name="style.css" library="css" /> -->
<!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">
    <h:head>
        <title>HOME</title>
        <?xml-stylesheet type="text/css" href="style.css"?>

        <link rel="stylesheet" type="text/css" href="css/style.css"/> 

        <h:outputStylesheet name="style.css" library="css" />

        <h:outputStylesheet name="css/style.css" />

        <h:outputStylesheet name="css/style.css" library="css" />

        <!-- <ui:insert name="codecss" /> -->
    </h:head>
    <h:body >
        Hello from Facelets
        <h:column>
            <h:form>
                <menu>
                    <ul>
                        <li><h:commandLink value="Novo Usuário" action="novoUsuario.xhtml"/></li>
                        <li><h:commandLink value="Agenda de Eventos" action="agendaEventos.xhtml"/></li>
                    </ul>
                </menu>    
            </h:form>           
        </h:column> 
        <h:form class="teste">
            <br />
            Novo Usuário<br />
            Nome:<h:inputText value="#{usuarioBean.nome}" /><br />
            Login:<h:inputText value="#{usuarioBean.login}" /><br />
            Senha:<h:inputSecret value="#{usuarioBean.senha}" /><br />
            <h:commandButton value="OK" /> <br />

        </h:form>

        O usuário foi criado: <br />
        Nome: #{usuarioBean.getNome()} <br />
        Login: #{usuarioBean.getLogin()} <br />
        Senha:#{usuarioBean.getSenha()} <br />

    </h:body>
</html>

the content of the css file is:

.teste{max-width:960px;margin:0 auto;}
zx485
  • 28,498
  • 28
  • 50
  • 59
  • Possible duplicate of [How to reference CSS / JS / image resource in Facelets template?](https://stackoverflow.com/questions/8367421/how-to-reference-css-js-image-resource-in-facelets-template) – BalusC Jul 16 '17 at 22:29

1 Answers1

0

check this How to include cascading style sheets (CSS) in JSF

the key is locate the css in the resource folder of the project

  • Hi, thanks for this answer. Most of these sorts of questions, already have an existing Q/A in Stackoverflow. It is better to find these and mark the question as such.In addition this is a little to much a (external) 'link only' answer (although you add some small text on where the issue is). Those are prone to removal of the external page/information, rendering the answer useless. So to prevent that, it would have been better to add some additional detail (if there would not have been a 'duplicate' in Stackoverflow)... Cheers! – Kukeltje Jul 17 '17 at 07:56
  • thanks! i'm new trying to feedback help to my favorite page , exists some page about how to correct way to answers (duplicated questions) (apart of your feed)?? – Jeisson Huerfano Jul 17 '17 at 13:15