Java+jsp+mysql Web page Production summary (1)

Source: Internet
Author: User
Tags apache tomcat

Spaces  


Error:
Request.getrequestdispatcher ("adminland.jsp"). Forward (request, response), blank after jump
Solution: Add request.setcharacterencoding ("GBK") to the function;

<ifranm></> Jump Failed
FIX: Link in top <a href= ".... jsp" target= "_parent" ></a>

Error: The Chinese character is stored in the database, and it becomes garbled after being read out
FIX: The URL of the database connection is changed to
Jdbc:mysql://localhost:3306/jinxiaocun?useunicode=true&characterencoding=gbk

For Get method URL pass parameter Chinese garbled
Resolution: The obtained parameters are transcoded: String args= request.getparameter ("GroupName");
string result = new String (Args.getbytes ("iso-8859-1"), "GBK");


Error: Org.apache.jasper.JasperException:Unable to compile class for Jsp:an error
occurred at LINE:20 in the JSP file:/error.jspexception cannot be resolved
Solve:
The first line should read
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"
Iserrorpage= "true"%>

Join data not successful
Resolution: 1. Database connection password user name is correct
2. Whether to pass the URL with the Get method
The Name property in the <input> tag in 3.jsp is correct


Error: null pointer error occurred when referencing map
Cause: It is possible that map is empty, that is, there is no matching data in the database when the map is loaded
Workaround: When loading a map, first determine if there is a data match
Method 1: First list to determine whether the List.size is 0
Method 2:resultset rs = Pstmt.executequery ();
Rs.getstring ("Count") is 0

500 error occurred, type is XXX jar does not work
Resolution: 1. See if the jar package is imported
2. In the Java build path librarise see if there is a jar package with a red Cross, if any, modify the path with edit,
Cannot delete re-import


Appear
HTTP Status 404-/jinxiaocun/a.java
Type Status Report
Message/jinxiaocun/a.java
Description The requested resource is not available.
Apache tomcat/6.0.41
Solve:
modifying in an XML file
<servlet>
<servlet-name>HelloWorldServlet</servlet-name> <servlet-
Class>helloworldservlet</servlet-class> </servlet>
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name> <url-pattern>/helloworldservlet</url-
Pattern> </servlet-mapping>


Warning:
After you have copied the folder directly, the deployment has a warning: whether to delete the existing files
Solve:
Modify the. MyMetadata context-root= "/[The name of your own folder" under the project folder.

Error: Java+jsp picture is not loaded
Solve:
1. Changing the Save function
Servletutilities.savechartaspng
Servletutilities.savechartasjpeg
2. Modify the Wel file to
<servlet>
<servlet-name>DisplayChart</servlet-name>
<servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DisplayChart</servlet-name>
<url-pattern>/servlet/DisplayChart</url-pattern>
</servlet-mapping>

Java+jsp+mysql Web page Production summary (1)

Related Article

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.