Hi, I am developing a web application using hibernate and AWS SDK (though I haven't been working on java for long). I have the following servlet and JSP code:
and my authentication method is:
When I run the project, The customer name is displayed, i click the link and next webpage with the url : http://localhost:8080/CustomerRecords/ServiceApp?accountID=12345678 is opened but i do not see anything in either the console or the webpage. I have a table in my database that has columns accesskey, secretkey, accountID, companyName etc. I want to authenticate the user using the secret and access keys from the database of the particular customer I click on my webpage. What am i possibly doing wrong?
NOTE: When I had given the parameters in the authentication method as hard-coded values, and was simply calling my other methods from GET method, I was getting the outputs.
Plus, is there any way that I can use the POST method instead of GET.
Please let me know if I should add more code in my question but I guess that would be enough.
Any help would be much appreciated. Thanks
You have an empty catch block in your doGet.
You could well be getting an exception and not know anything about it.
posted 3 years ago
There was an empty catch clause so i was unable to see the exceptions, problem is with MD5 decoding. I removed the catch clause and commented the lines from my decode method:
// String decrypted = decrypt(encrypt(str));
// System.out.println("Decrypted: " + decrypted);
although the encoder method works fine.
Now i see the following exception :
You'll get a NullPointerException, so that should be fairly easy to debug.
I would guess str is null for some reason...
And another remark about your code: is there any reason why your static (class) members are not initialized in a static initializer block, but are each time assigned in the encrypt/decrypt methods? If you need another instance with each invocation of the encrypt/decrypt methods, it should not be static (class) members, but local variables! Otherwise you should initialize them in a static initializer block (and marked as final).