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

Source: Internet
Author: User

Problems encountered today:

1.

When adding information to the list page, after jumping to the Doadd page, click the Save button and be able to jump back to the list page, but the new information cannot be displayed, as if the add operation was not performed.

What's the problem?

① is not to the level JDBC cannot connect to the database?

Verified not for this reason

② in the addgrade.jsp page jump page code directly into the dolistgrade.action, jump directly to the list page, it is clear that there is no call to add operations, it is not possible to display the information to be added

This issue has been resolved

-------------------------------------------------------------------------------------

2.

View operation time, jump page, cannot display detail page, report null pointer, say this sentence, prompt say if condition report null pointer,

String Strgradeid = Request.getparameter ("gid");

int Gradeid = 0;

if (!strgradeid.equals (""))

{

Gradeid = Integer. parseint (Strgradeid);

}

① is not the page value passed to the servlet process, failed to fetch? Gid?

The problem is that you should write the jump address of the parameter in the href attribute of the A element of the list page:

<a href= "Dodetail.action?gid=${grade.gid}" >

This writing, need attention, is the first time encountered. A element plus parameters, with? Separate parameters, use = to separate value

has been resolved

-------------------------------------------------------------------------------------

3.

Modify action: Do not show class name

<input type= "text" name= "Gradename" value= "${grade.gname}"/>

Where is this problem?

The Toupdategrade page should be the same as the servlet being viewed, with values passed to the servlet and to the polygon.

But, I wrote down these two sentences.

---------------------------------------------------------------------------------------------

4.

Modify the operation:

Click the Save Information button, NumberFormatException is the format conversion is not correct, what is the reason?

This exception is thrown when an application attempts to convert a string to a numeric type, but the string cannot be converted to the appropriate format.

Get.parameter The argument is not clear, this sentence is the page has value to the servlet? So, his argument should be the name attribute set on the input on the page.

The problem is that Gradeid does not match the fault of the newspaper.

So why gradename-----gname can run?

----------------------------------------------------------------------------------------

5.

Why does the blank appear when I finish modifying my name?

Answer: This question is still an extension of the last question. Just said above, why Gradeid do not match will error, and Gradename do not match the time, there is no impact.

In fact, not without influence, Gradename does not match words, after modification, is unable to display, display blank.

----------------------------------------------------------------------------------------

6.

Delete operation:

Get.parameter must be a GID, which is the property you set at the beginning.

For viewing and modifying operations:

Get.paremeter must be the Name property in the <input/> property that you set.

The view operation simply finds the name value through the ID primary key, so setting the Name property in input does not work;

In the modification, because the SQL statement is determined to modify the name value by the primary key, all two are used, and the primary key (on the updategrade.jsp page) is hidden, and the Get.parameter parameter must be the same as the property value set.

The Name property value is different, click the Modify button, report 500 error.

The id attribute value is different, after the modification, displays the blank, the modified name cannot display normally.

Javaweb Learning 006-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.