Formulario de login do Spring Security

3 respostas
lucasbf1992

Tenho o seguinte formulário principal que funciona corretamente

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html">
    <head>  
        <title>Autenticação</title>  
    </head>  
    <h:body>
        <ui:composition template="template.xhtml">
            <ui:define name="menu"></ui:define>
            <ui:define name="corpo">

                <p:panel header="Acesso ao Sistema" style="position:absolute; left:50%; top:50%; margin-left:-120px; margin-top:-45px;">
                    <h:form>
                        <center>
                            <h:outputText value="Usuário ou senha incorretos!" rendered="#{param.erro}" style="color: darkred"/>
                        </center>
                     </h:form>    

                    <form action="j_spring_security_check" method="post">  

                        <table>
                            <tr>
                                <td>
                                   
                                  <h:outputLabel for="j_username" value="Usuario: *" /> 
                                </td>
                                <td>
                                  <p:inputText  type="text"  id="j_username" required="true"/> 
                                </td>
                            </tr>
                            <tr>
                                <td>
                                   
                                <h:outputLabel for="j_password" value="Senha: * " />
                                </td>
                                <td>
                                    <p:password  id="j_password" required="true"/> 
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <center>
                                        <h:commandButton value="Acessar"/>
                               
                                    </center>


                                </td>
                            </tr>
                        </table>
                    </form> 
                           
                </p:panel>

            </ui:define>
        </ui:composition>
    </h:body>  

</html>

porém no rodapé da página aparece a seguinte mensagem :"The button/link/text component needs to have a Form in its ancestry. Please add . "
[img]http://i59.tinypic.com/2j0i2dx.png[/img]

3 Respostas

g4j

O erro indica que estes componentes necessitam estar dentro de h:form.

Tente colocar h: na frente de da declaração do form e teste novamente.

lucasbf1992

cara eu já fiz isso, porém quando coloco o h, o spring security deixa de fazer a autenticação

lucasbf1992

Alguém tem algum ideia ? necessito urgente solucionar isso

Criado 16 de junho de 2014
Ultima resposta 19 de jun. de 2014
Respostas 3
Participantes 2