What has been done today: =
1. class module, List page Add class information operation, Chinese garbled problem still unresolved
The two days of work are:
First build the main page: is composed of top, left and right three parts, stitching together.
Process: After successful landing, jump to main page.
Left sidebar, showing class information, student information, course information, hobby information, user information and so on.
The next thing to do is to gradually complete each of these modules.
The first thing to do is to add information to the class module operation.
The equivalent is in each module, should have this one, will need this action.
Step: Click Add button, write Toaddservlet, write addgrade.jsp-> save information button->doaddgradeservlet
Finished writing, return to List page, Dolistgradeservlet
Key code: Doaddgradeservlet
String gradename = Request.getparameter ("Gradename");
Servlet has value passed to page
Grade Grade = new Grade ();
Grade.setgname (Gradename);
Gradebiz biz= new Gradebizimpl ();
int rows = 0;
rows = Biz.addgrade (grade);
Interacting with Biz
Request.setattribute ("Rows", rows);
T jump page
Request.getrequestdispatcher ("Dolistgrade.action"). Forward (request, response);
This step can not jump directly to the list page, you need to jump to the list of the servlet page above, perform the query operation
--------------------------------------------------------------------------------------
View of Element a
View page does not require form element
Four questions of normal programming servlet in direct Dodetailservlet. Then create a view of the page and finally return to the list page.
The point is: the list page
<a href= "Dodetailgrade.action?gid=${grade.gid}" > View </a>
This line of code is written.
Modification of a element
Note Hide the primary key
Update grade set Gradename= ' where gid= ' need to call two, to reduce code duplication, need to hide the primary key ID
----------------------------------------------------------------------------------------
Javaweb Learning 005-4 pages, 5 SQL statements (add, view, modify, delete)