In servlet we use for text data
String uname=request.getParameter("uname");
For numeric data we use
int contact=Integer.parseInt(request.getParameter("contact"));
Which should i use for email,date and time in servlet?
Actually I'm using HTML5 where I use email as
<input type="email" id="txtEmail" name="email" required>
Date as
<input type="date" id="dateBirthday" name="birthday" required>
Time as
<input type="date" id="dateBirthday" name="birthday" required>
So which should i use in servlet?
Servlet api does not provide any special way of getting date and email. getParameter will always get you a
String
value. It is up to you how you want to treat it.For date you can work with raw String data or you may want ot parse it in to a
Date
object as per your convinence. But make sure you know the Date pattern before parsing it.