Home > Article > Web Front-end > How to change html code into jsp code
How to change html code into jsp code: 1. Directly modify the Html file and add relevant code; 2. Replace the content in the [] tag in the html with the [] content in the jsp page.
The operating environment of this tutorial: windows7 system, html5 version, DELL G3 computer.
How to change html code to jsp code:
1. Directly modify the Html file:
Add code directly to the top of the original testPage.html page :
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
Just change the suffix to jsp.
2. Create a new jsp file:
Replace the content in the tag in the html with the in the jsp page Just the content.
Note: The first line in the jsp page:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
is changed to:
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
Extended information:
When converting HTML to XHTML, pay attention to the following points:
1. Add a description of the document type at the head of each page.
For example: "!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "》
Of course you can choose other types.
2. Both tags and names should be in lowercase.
You can write a replacement program yourself to change all the tags in your HTML document to lowercase letters, and the name attribute must also be changed to lowercase.
3. All attribute values must be enclosed in quotation marks.
4. Separate tags.
For example: "hr", "br" and "img" must be ended by adding / at the end. It is not recommended to use methods such as "img" and "/img" here. Just add / directly after it, such as "br /".
5. Open the official website of W3C DTD: http://validator.w3.org/check/referer. General errors during verification may appear in your tag nesting. You can also use the conversion tool tidy provided by the official website to achieve the conversion: http://www.w3.org/People/Raggett/tidy/,
6. Open the following page directly and enter the URL directly to verify Our program: http://validator.w3.org/check?uri=http://moban.7880.com/
Related learning recommendations: html video tutorial
The above is the detailed content of How to change html code into jsp code. For more information, please follow other related articles on the PHP Chinese website!