jdbc jsp servlet integration
Jdbc-servlet-jsp integration
Your current task is to insert Employee details at least 10 records into database and showing inserted results into the browser.
Things need to done:
Step 1: To insert details create one jsp with the following fields :
1.Employee.jsp:-
Employee Id(textbox)
Employee Name (Text box)
Designation (Dropdown)
Salary (textbox) ----- If you want to add any field then you can add it.
Note: - [Dropdown options like: Trainee Engineer, Software Engineer, Tech lead etc...]
2.EMPLOYEE Table :
Column Name Type Not Null Constraints Comments
Eid Number Yes Primary Key -
Ename Varchar2(50) Yes - -
Designation Varchar2(50) Yes - -
Sal Number Yes -
3. EmployeeServlet: this is the servlet where you can get the User interface details regarding the Employee and establishes the connection with the database, execute your queries ,setting your result set in request scope and displaying the results in results.jsp
Note: I recommend separate layer (class) to write the database logic so create one class to interact with the database and you can use the class in servlet by creating the object of the class
Example :
Class EmployeeServlet
{
service(-----)
{
EmployeeDao empDao=new EmployeeDao();
empDao.insertEmployee(--);
ResultSet rs=empDao.retrieve(--);
}
}
4.EmployeePojo.java :
I recommend its better to create this class to set all the user interface details to one object and pass this object to EmployeeDao
For Example :
service(-----)
{
String eid= request.getParameter(“eid”);
Employee empObj = new Employee();
empObj.setEid(eid); etc...
EmployeeDao empDao=new EmployeeDao()
empDao.insertEmployee(empObj);
}
5.EmployeeDao :
It contains connection logic and user defined methods to insert and retrieve the records.
6.result.jsp: it displays the result in table format
Re: jdbc jsp servlet integration
I've moved this thread to the JSP forum.
That's NOT how this works. All you've done is dump your homework here with no explanation of what you've tried or where you're stuck. That's extremely rude. Please read the link in my signature on asking questions the smart way before you post again.
Re: jdbc jsp servlet integration
i dont know how to post .ok i not able to understand it.i created table of database.one jsp page containg details of the employee and one servlet to connect the details with the database .can u suggest exactly what it is.
Re: jdbc jsp servlet integration
Did you read the link on asking questions the smart way? More recommended reading: http://www.javaprogrammingforums.com...e-posting.html
Re: jdbc jsp servlet integration
Thank you for ur kind suggestions.They helped me alot.I completed the work as required and eventhough it had some warnings.i will check out those problems and fix them.Once again thanks for your help.They help me not even now and in future also.
Re: jdbc jsp servlet integration
Hello,
I need to let users interact with my web application so they can insert their personal comments.
I store these comments (with line breaks, tabs, spaces...) in a mysql DB, but when I get them from DB and display in JSP, no line breaks, tabs or spaces are shown...(I'm using Struts 2 < s : property value="comment"/>)
If I look how the comments are stored in DB (e.g with SqlDeveloper) I can see the line breaks, tabs and spaces
anybody knows how to solve this problem??
thanks in advance
Re: jdbc jsp servlet integration
Quote:
Originally Posted by
saurus
Hello,
I need to let users interact with my
web application so they can insert their personal comments.
I store these comments (with line breaks, tabs, spaces...) in a mysql DB, but when I get them from DB and display in JSP, no line breaks, tabs or spaces are shown...(I'm using Struts 2 < s : property value="comment"/>)
If I look how the comments are stored in DB (e.g with SqlDeveloper) I can see the line breaks, tabs and spaces
anybody knows how to solve this problem??
thanks in advance
Start your own thread. You aren't going to get much attention just adding your question as a reply to another one.