does request.getParameter() return string type only?

Reply

Join Date: Jan 2008
Posts: 49
Reputation: Ankita B is an unknown quantity at this point 
Solved Threads: 0
Ankita B's Avatar
Ankita B Ankita B is offline Offline
Light Poster

does request.getParameter() return string type only?

 
0
  #1
Feb 8th, 2008
Hi,
I am tryin to insert values entered by user into oracle db.I am using jsp and java beans for this.request.getParameter() works fine for string parameters but what should i use for fields such as date?..thx
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,647
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 473
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: does request.getParameter() return string type only?

 
0
  #2
Feb 9th, 2008
Yes, request.getParameter() always returns a string unless you plan on challenging the API.

As far as date is concerned, you can decide on a format which you would be expecting from your users. At the server side, pull the date values entered by the user as a string, try to parse that using the SimpleDateFormat class. If an exception is thrown, the user entered an invalid or unacceptable date; if no exception, then you would get a java.util.Date object which can be then converted to a java.sql.Date object which can then be persisted to a database.
I don't accept change; I don't deserve to live.

Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for JSP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC