Compare.Equal Method



I am working on the LoginForm and I am trying to compare the username entered with the Username in the Table.


		public void onLogin(LoginEvent event) {
			String pw = event.getLoginParameter("password");
			String uname = event.getLoginParameter("username");
			System.out.println("User Name:"+uname+" Password:"+pw);
			OBPContainers containers = new OBPContainers();
			SQLContainer logincontainer = containers.getLoginContainer();
			System.out.println("Login Containers:"+logincontainer.getItemIds());

// logincontainer.addContainerFilter(new And(new Equal(“OBP_UNAME”,uname),new Equal(“OBP_UPASS”,pw)));
// logincontainer.addContainerFilter(new Equal(“OBP_UNAME”,event.getLoginParameter(“username”)));
Filter filter = new SimpleStringFilter(“OBP_UNAME”, uname, true, false);
// logincontainer.addContainerFilter(“OBP_UNAME”, uname, true,true);
System.out.println(“Login Containers:”+logincontainer.getItemIds());

User Input: apple

Table Entry: Apple

The Compare.Equal returns ‘true’ even though the first letter is not the same? I have tried giving the ‘false’ for the ‘IgnoreCase’ in the Filter as well.

Could someone please let me know what is that I am missing?

I must have set it to ‘false’ for ‘IgnoreCase’. -_-

I have modified the code as below and then it works awesome. Vaadin is awesome. :)

			Filter uname_filter = new SimpleStringFilter("USER_NAME", uname, false, false);
			Filter upass_filter = new SimpleStringFilter("USER_PASS", pw, false, false);
			logincontainer.addContainerFilter(new And(uname_filter,upass_filter));