Javaweb Learning 005-4 pages, 5 SQL statements (add, view, modify, delete)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.