getValue() method of Input component returning null
Hi Folks,
I have a Password Component which models an encryption solution between the browser and the Java tier. What I did basically is :
1. This component is an Input component (meaning I render an HTML "input" element of "type" "password". ). Inside the constructor I have another HTML "input " element of type "hidden". My intent is that when this component is rendered it will render a java script which will encrypt the value typed for password (using some complicated logic ofcourse) and put that encrypted value into the hidden field and then will submit the form also.
Now my problem is that on the server side I want to get that encrypted value so that that I can decrypt it . For that I have kept a binding to the the component itself on my login page and inside the backng bean method processLogin(ActionEvent event) method one code snippet using HttpServletRequest is working whereas getValue method on that hidden input is returning null. What am I doing wrong here ?
//This code snippet doesn't work
String encryptedPassword = (String) this.getPasswordComp().getHiddenInput().getValue();
System.out.println("encryptedPassword = " + encryptedPassword);
//this is returning null
//This works
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String encryptedValue = request.getParameter(this.getPasswordComp().getHiddenInput().getClientId(FacesContext.getCurrentInstance()));
System.out.println("encryptedValue = " + encryptedValue);
//This is returning the proper value

