Powerful solutions for garbled Chinese characters when JSP pages contain HTML files!
(09:37:26)Add the following to the project's web. xml file:Code:
Special Property Group for JSP configuration html
Example.
4. jsp will eventually be converted to servlet for execution.5. jsp declaration format: , script segment format: , when the server converts JSP to servlet, will convert the Declaration in JSP to the classMember variable, and the script segment is
Step 1: TLD Function Definition:
First, under the WEB-INF folder under the project folder, see a function-taglib.tld File
This file is actually an XML description file with the following content:
Xmlns: xsi =
Myeclipse sets the default encoding method for JSP pages:
Windows-preferences-myeclipse-files & editors-JSP-encoding on the right: Set to iso000046/Unicode (UTF-8)
In the Java file, myeclipse sets the author, date, and other
Servlet to obtain the absolute path of the project string filepath = This. getservletconfig (). getservletcontext (). getrealpath ("/"); absolute path of the root directory: request. getservletpath (); absolute path of the file: request.
Package com. longweir;// An After paginationImport java. SQL .*;Import com. longweir. util .*;Public class pagebean {Private int pagesize = 5; // The number of records displayed per page is 5Private int currentpage = 1; // current page numberPrivate
Copyright Disclaimer: During reprinting, please use hyperlinks to indicate the original source and author information of the article and this statementHttp://b0r0j0.blogbus.com/logs/2186437.html
[Abstract] The purpose of this article is to greatly
JSP page tag definition:
Implementation BehaviorThe first step to implement tag behavior is to move the scriptlet code from its original location to a Java class (lastmodifiedtag), as shown in Listing 1:
Listing 1. Create a timestamp tagPackage com.
1. Page ObjectThe page object represents the JSP itself. More accurately, it represents the servlet after JSP is translated. It can call the methods defined by the servlet class.Ii. config objectThe Config object stores some initial servlet data
Preface the paging function is inevitable during database usage, but JDBC specifications do not solve this problem well. Many of my friends have their own solutions for this demand. For example, we use a collection class such as vector to save the
1. During program development, we often encounter Chinese garbled characters:
1. garbled characters are sent from the page to the background. What should I do?
You can add the following code before accepting the page value transfer:
Request.
JSP's support for file uploading is not as good as PHP's support. It is directly implemented as a function, not as it can be implemented through components in ASP. JSPs can be implemented through JavaBean. However, there is no need to write an
Tomcat webapps to create a directory validate, build a WEB-INF Directory, which creates a web. xml file, the Code does not need to be written, there is a statement on the line: Web. xml:
Xmlns = "http://java.sun.com/xml/ns/j2ee"
Xmlns: xsi = "http:/
① Out-javax. servlet. jsp. jspwriterThe out object is used to output the result to the webpage.
Method:1. Void clear ();Clears the content of the output buffer but does not output it to the client.
2. Void clearbuffer ();Clear the content of the
Nine built-in objects and functions:
1. Request object: the client's request information is encapsulated in the request object, which can be used to understand the customer's requirements and then respond.2. Response object: The response object
Definition: member variables that can be used in JSP page scripts (Java program slices and Java expressions) without declaration
JSP has nine basic built-in components (which correspond to the six internal components of ASP): request, response,
(1) JSP is essentially a servlet. When a user sends a request to a specified servlet, the servlet dynamically generates an HTML page using the output stream, includes every static html tag and all the content that appears on the HTML page.
(2) a jsp
The Config object indicates the current JSP configuration information, but the JSP page usually does not need to be configured, so there is no configuration information. This object is rarely used on JSP pages, but the user is large in servlet,
Response indicates the server's response to the client. Most of the time, the program does not need to use response to respond to client requests, because there is a simpler response object ------ out, which represents the page output stream, and it
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