Several minor issues encountered during JSP development

Source: Internet
Author: User

Since the contact with JSP, we have been constantly encountering various problems, constantly querying information, and constantly exploring. Compared with ASP. NET, JSP gives me the feeling that the development idea is relatively complicated, the development tool is too automated, and a lot of web page running principles need to be understood.

① The page parameters are garbled when being passed in Chinese.

JSP generally uses the default encoding method when obtaining page parameters. If the encoding type of the page parameters is different from the default encoding type, garbled characters may occur. One way to solve this type of Garbled text problem is to force the request to get the parameter encoding method before obtaining the parameter on the page:

Request. setcharacterencoding ("GBK") or request. setcharacterencoding ("gb2312 ").

Another method is to encode the obtained parameters, for example:

String searchstrtemp = (string) request. getparameter ("text1"). Trim ();

String searchstr = new string (searchstrtemp. getbytes ("8859_1"), "gb2312 ");

② An error occurred while connecting to DB2 using JDBC in JSP

I encountered this strange problem. After the connection parameters are written, you can connect to the DB2 database by default without any settings. Sometimes, the program reports a connection error suddenly. Restart, sometimes it will be better, sometimes it will not work. Later I thought it may be because the program had a problem with DB2 when connecting to the database multiple times, which caused the JDBC Applet Server to be closed. Run the db2jstrt command or start the JDBC Applet Server in the control panel service to solve this problem.

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.