3
I have the following problem:
I want to create a login screen and password. I’m using the primefaces to pick up the components, but I’m not getting the field to fill in the password.
Analyzing with my lay view, it seems that he does not recognize the tag of the primefaces
Component link in the primefaces: https://www.primefaces.org/showcase/ui/input/password.xhtml
index.xhtml:
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!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://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Pagina Incial da Biblioteca</title>
</h:head>
<h:body>
<h:form>
<p:messages id="messages" showDetail="true" autoUpdate="true" />
<h:panelGrid columns="2" id="matchGrid" cellpadding="5">
<h:outputLabel for="pwd1" value="Senha: " />
<p:password id="pwd1" value="#{passwordView.password5}" match="pwd2" label="Password 1" required="true" />
</h:panelGrid>
<p:commandButton update="matchGrid" value="Entrar" />
</h:form>
</h:body>
</html>
Passwordview:
import javax.faces.bean.ManagedBean;
@ManagedBean
public class PasswordView {
private String password1;
private String password2;
private String password3;
private String password4;
private String password5;
public String getPassword1() {
return password1;
}
public void setPassword1(String password1) {
this.password1 = password1;
}
public String getPassword2() {
return password2;
}
public void setPassword2(String password2) {
this.password2 = password2;
}
public String getPassword3() {
return password3;
}
public void setPassword3(String password3) {
this.password3 = password3;
}
public String getPassword4() {
return password4;
}
public void setPassword4(String password4) {
this.password4 = password4;
}
public String getPassword5() {
return password5;
}
public void setPassword5(String password5) {
this.password5 = password5;
}
}
Error presented:
mar 20, 2019 8:58:35 AM com.sun.faces.renderkit.html_basic.Htmlbasicrenderer getForComponent WARNING: Unable to find component with pwd1 ID in display.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>2BIIM_Aula9_JSF</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
Would you kindly include all the code in your
index.xhtml
?– nullptr
I updated, now with the full index.xhtml
– LucasTrigoSchott
You can also post the screen print that is not opening?
– nullptr
Updated, the first faces link shows how it should look. Link: https://www.primefaces.org/showcaseui/input/password.xhtml
– LucasTrigoSchott
you set up your
web.xml
mapping the JSF database? Something likejavax.faces.webapp.FacesServlet
? If you haven’t mapped the extension.xhtml
to go through the page will not be rendered accordingly. Please post yourweb.xml
– nullptr
Updated, in Image 1 and 2 of web.xml there is javax.faces.webapp.Facesservlet, but I’m not entirely sure it’s correct.
– LucasTrigoSchott