Here's the thing, I need to create three dropdown lists each for day, month, year. Once these are selected, after clicking a button, the three selected values need to be concatenated and bound to a date column in a database table.

String month=request.getParameter("month");
String date=request.getParameter("date");
String year=request.getParameter("year");

how to concat these three parameters ...

Recommended Answers

All 8 Replies

Why do you want "JSP coding", when you're currently using Java coding? Don't tell me you used a scriplet to get those values. Don't tell me that you don't know about ${param.xxx} JSP syntax. Why does everybody dive immediately into JSP and never look at the tutorials?

The J2EE(TM) 1.4 Tutorial
- The Java EE 5 Tutorial
- The Java EE 6 Tutorial

And as far as "concatenating" the values simply "output" them one after the other.

String month=request.getParameter("month");
String date=request.getParameter("date");
String year=request.getParameter("year");

plz tell me how to concat these three parameter in to date format(year-month-day) !!! so that it is easy to insert date value in data base...

String bogus = year + month + date

Why do you want "JSP coding", when you're currently using Java coding? Don't tell me you used a scriplet to get those values. Don't tell me that you don't know about ${param.xxx} JSP syntax. Why does everybody dive immediately into JSP and never look at the tutorials?

The J2EE(TM) 1.4 Tutorial
- The Java EE 5 Tutorial
- The Java EE 6 Tutorial

And as far as "concatenating" the values simply "output" them one after the other.

i want to concat those three parameters in date format(year-month-day) so that it is easy to insert in to database

String bogus = year + month + date

String date=year+"-"+month+"-"+day;


is it correct ???

Did you try it?

Aside from the fact that you should be using PreparedStatement, create an actual Date object from that info, using a Calendar instance probably, and then using PReparedStatements setDate, but judging by the rest of tall this you are already in over your head and have no interest in learning how to do anything properly. A "close-enough-for-government-work" attitude.

Did you try it?

Aside from the fact that you should be using PreparedStatement, create an actual Date object from that info, using a Calendar instance probably, and then using PReparedStatements setDate, but judging by the rest of tall this you are already in over your head and have no interest in learning how to do anything properly. A "close-enough-for-government-work" attitude.

ya it working thanks a lot

Did you try it?

Aside from the fact that you should be using PreparedStatement, create an actual Date object from that info, using a Calendar instance probably, and then using PReparedStatements setDate, but judging by the rest of tall this you are already in over your head and have no interest in learning how to do anything properly. A "close-enough-for-government-work" attitude.

ya its working thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.