• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsf/pf not displaying value for password type input  RSS feed

 
nek johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am trying to get through JSF /PF tag for h:inputSecret but its not taking or displaying value. Please see the code snippet below

demo.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://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
>

<h:body>
<h1>JSF 2 password example</h1>

<h:form>
Password : <h:inputSecret value="#{userBean.password}" />


<h:commandButton value="Submit" action="user" />
</h:form>

</h:body>
</html>



user.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://java.sun.com/jsf/html">

<h:body>
<h1>JSF 2 password example</h1>

Password : <h:outputText value="#{userBean.password}" />

</h:body>
</html>



UserBean

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.test;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import javax.inject.Named;

//@ManagedBean
@Named("userBean")
@SessionScoped
public class UserBean {

private String password;

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

}



I am using JSF 2.2.


Thanks for info


Nek
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can make your code and XML samples easier to read by using the "Code" button of the message editor to insert formatting tags around them.

I can't see anything obvious. Try adding a <h:messages> tag to your xhtml and see if an error message displays.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!