Skip to content
Advertisement

Passing Date from an HTML form to a servlet to an SQL database

I have a problem getting an inputed date (yyyyMMdd) from an HTML form to a sql database via a servlet. The date from the form passes to the servlet as a string but then somehow I need to convert it to date for storing in the database.

I have tried a number of methods, date formatter etc.. A possible way of doing it is to convert it to a long and then format it however this seems like a slight bodge.

Any thoughts would be appreciated.

Okay this includes the code of the form and the servlet. I have left the buisness object out.

The form:

The Servlet: (Sorry tried using the code samle facility but for whatever reason it was not loving it.)

Sorry for the extended dribble but in context maybee it makes more sense.

Advertisement

Answer

Several hours later and it works… Thanks

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement