Im trying to design a financial year table...wherein the user enters the data in the table and the same is updated in backend.i have successfully desinged the page but i have certain doubts in jsp code.the table is as follows:
MS_target HSD_Target ALPG_Target Lubes_target
april
May
June
July
August
September
october
november
december
january
february
march
The HTML code is fine but im confused on to the JSP part as using an array is not possible.
I have tried using the hastable by creating a hashmap for all the months.
is it fine to use hashmap...or else kindly suggest me to some alternative.I have given names for all fields separately(eg:aprMS,aprHSD,mayMS,mayHSD).also suugest me a code on how to iterate through all the fields.
The HTML code is fine but im confused on to the JSP part as using an array is not possible.
I have tried using the hastable by creating a hashmap for all the months.
is it fine to use hashmap...or else kindly suggest me to some alternative.I have given names for all fields separately(eg:aprMS,aprHSD,mayMS,mayHSD).also suugest me a code on how to iterate through all the fields.
You can use any of the collection and set them in request scope through Servlet and then dispatch the request to JSP page. You can then access/iterate these collections through JSTL tags.
hashmap for all months.but i have doubts on how to read the hashmap data and insert the same in database. Kindly help
You can submit the form to a Servlet and get the values submitted through request.getParameter(" ") .
Satish Nair
Greenhorn
Joined: Apr 04, 2012
Posts: 23
posted
0
Can you give me an example for the former part.....i got the later part.....im a new bie...kindly help....thnanks in advance
Thanks for your help(piyush and Bear).As i am a new bie to jsp i understand what you explain but i am finding it difficult to put on code.To get a better picture i would like to explain my project..My project is to design a financial year table where the months are placed on Y axis and The targets are placed on X axis.now the user enters the target details.eg MS_target for the month of april.like wise the target for every field is entered.If suppose the user enters the data for april and clicks on submit the same is updated in table.If after a month the user logs in to enter the details for remaining months the previous data entered should reflect in my page and user can continue entering data for remaining months.
Satish Nair
Greenhorn
Joined: Apr 04, 2012
Posts: 23
posted
0
I have managed to put in the code.....kindly help in editing the same.
Satish Nair
Greenhorn
Joined: Apr 04, 2012
Posts: 23
posted
0
i am srry....i do understand that i jst had to zero in on the code which is not proper....but what i meant was to show you the entrie code so as to what changes could be made to the entire code
Satish Nair
Greenhorn
Joined: Apr 04, 2012
Posts: 23
posted
0
How do i go ahead to iterate the data and insert the same in the database?
If you're looking for an example of how to insert data into a database, then choosing to ask that question in the JSP forum was a bad choice. You shouldn't even have code in a JSP which works with a database, that's a job for the servlet which acts as its controller.
But anyway, an example of inserting data into a database: I'm sure you should find an example in Oracle's JDBC tutorial.