Forums Register Login

saved records in a database from servlet.

+Pie Number of slices to send: Send
i am beginner .

1-i have created servlet program which takes username,password,hobby,gender and saved in a database .
but except username all saved(username column is blank for every entry and all other column filled).

2-i have commented on the statement of(if(password.equals("cnfrmPassword")) and at last i wrote a else statement) matching password and conform password and when i uncommented then always output come that (password and confrmpassword didn't match)even i give same password..
please help me.
thanks



+Pie Number of slices to send: Send
post your jsp file also.


(if(password.equals("cnfrmPassword"))

here cnfrmPassword is treated as a string and not a variable.
this should be :


Also try to debug and check whether you are getting username value in servlet from jsp or not.
+Pie Number of slices to send: Send

Just a suggestion
setting DataSource in web.xml and then using getDataSource method for javax.sql.DataSource is better way for connecting to DataBase
+Pie Number of slices to send: Send
Probably the name of the username field and the one you are using in the getParameter may be different. Try debugging by using System.out after you receive the parameters in your servlet.
+Pie Number of slices to send: Send
 



Just a suggestion
setting DataSource in web.xml and then using getDataSource method for javax.sql.DataSource is better way for connecting to DataBase



Using a datasource would be efficient in case of multiple connections. in the sense when you have a pool of connections and want them to be used judiciously.

In case of single connection, I would connect using DriverManager.

Correct me if am wrong.
+Pie Number of slices to send: Send
thank you so much its working...
Goodbye moon men. Hello tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1033 times.
Similar Threads
Code error
I Have Problem To Separate Business Logic From Front Controller
problem with while loop when ResultSet.next() is called
Unable to direct to page after login
about hidden from fields
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:52:40.