Chinese processing is very troublesome during development. Some content is recorded as follows:
JSP file encoding: UTF-8Tomcat URI encoding: UTF-8
1. Get form data.
String atest = request. getparameter ("test ");If (Atest! = NULL &&! Atest.
1. Add the JSP writing file to the BOM header.
Note: In the following situations, Chinese garbled characters are not added without the BOM header. It just shows how to add the BOM header to the JSP output file.
Supplement:
Out. Write () is
JS obtains Java variables.Method ①: var A = ""Method 2:Control HTML nodes through JS, such as document. getelementbyid ("name"), $ ("# name"). Val (), etc.
Java JS Value
Generally, a hidden form element is used in the form, and then the JS
In the traditionalJSPProgram.CodeAndJava codeIt is convenient to write together, but it also makes the page difficult to maintain. The burden of HTML developers and JSP developers increases. We can turn this traditional technologyPage pulling data
How to Use JS programs:
Scripts can be written anywhere in hmtl or JSP.
1. . Several On the same page are interconnected, rather than independent, and variables can access each other. Like java code snippets in JSP.
2. demo : You can write
When we use include to include JSP files, we find that there are redundant blank lines on the final generated page, and there is a character that cannot be displayed in the source code. After checking some articles, we find that the problem lies in
1) HTML comment:You can use comments or expressions.2) Hide comments:Comments will be ignored during JSP compilation. the compiler will not compile the statements between them and it will not be displayed in the client's browser and source code.
3)
Jspinit () {}: this method is called when the JSP page is initialized, and this method is only executed once during initialization, therefore, the user performs initialization parameter configuration and other one-time work here, which is created by
For the Usage Analysis of JavaBean in JSP: We can use the scriptlet method: /
You can also use the method // bean. hellobean. Java:
package bean;public class HelloBean {private String str;public void setStr(String s){str = s;}public String getStr(){
JSPDynamic inclusion
Now let's take a look at the JSP dynamic include command:
Create a project testinclude
Then add the file:
Index. jsp:
index.jsp'srequest:
Curdate. Jsp:
curDate.jsp: curDate.jsp's request:
View
Two methods
Two methods are available for JSP include files:
1. Use the include tag, such
2. Use the JSP: Include tag, such
The difference is:
Method 1 is suitable for introducing static content with few changes, such as the header and footer
Master nine implicit objects:Request Response out session application pagecontext page config exceptionImplicit objects are objects that can be directly used on the page without the need for new objects. Note that... %> or ,
Request object: Stores
Seven JSP actions
An action can affect the output text stream and create an object by editing.Id attribute and scope attribute attributes of each JSP action.
ID: indicates the name of an action,
Scope: indicates the scope of an action. Scope values
In JDBC applications, if you are already a relatively level developer, you should always replace statement with preparedstatement. That is to say, do not use statement at any time.For the following reasons:I. code readability and
The simplest thing is to convert the URL Based on the URL rewriting (rewrite) module in various web servers:In this way, the program implementation will be almost unchanged? The link id = 234 is mapped to news/234.html, and looks like a static link
Resources: Use Ajax pages (send and respond), one processing server page, and one reusable net. js.1. html 1.html pick a region Eastern Western Northern Southern
Doublecomboxml. XML (defines the XML response format and can be deleted after
Database applications, especially Web-based database applications, usually involve the storage and display of image information. The common method is to store the image to be displayed in a specific directory, store the name of the image in the
Recently, a scheduled collection program needs to be compiled for the project, and a very simple method to deploy the scheduled process-using the listener and timer.First, write a servlet to start the timer and schedule the task. The reference
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.