Hi all,
I am learning JSP and Servlets. I am trying to do a small project in the area I have learned so far. Simply I am trying to do a MVC thing.
I am just adding/deleting/updating the customer registration details to the Database.
Now the section I havint the doubt.
I am using JSP for view that is, I am creating the form in the Customer.jsp (for example: Customer ID(int), Customer Name(char), Customer Age(int), Customer DOB(date))
I am using JavaBean for setting and getting the properties in Customer.java. (for example:
private String customer_id,customer_name,customer_age and customer_dob;
And getter and setter method.
Now whether the database connection and all other updating thing to the database should be kept at Servlets (i.e., Customer_Ser.java) or at JavaBean(i.e., Customer.java)
I have seen the database connection in JSP, Servlet and Javabean. I know it is very bad thing to do any database thing in JSP. But, which one is best to use the database connection ? in Servlet or Java (Javabean).
Is there any situation to use the database connection in JSP.
If possible, any sample coding(I have written the coding, but I want to know, which one is having better performance and also see how the real appln have coded in the MVC) for just adding the details to the database in MVC Pattern.
Thanks in advance,