DOCTYPE problem in myeclipse new JSP

Source: Internet
Author: User
The written html is copied to the jsp file, and the margin center in ie6 is invalid. This problem is not found in pure html. Jsp is created using myeclipse (AdvancedTemplates). The generated DOCTYPE is as follows: & lt ;! DOCTYPEHTMLPUBLIC & quot;-// W3C // DTDHTML4.01...

The written html is copied to the jsp file, and the margin center in ie6 is invalid. This problem is not found in pure html. Jsp is created using myeclipse (Advanced Templates). The generated DOCTYPE is as follows:

The DOCTYPE in the html file created using editplus is as follows:

It is precisely because of the different DOCTYPE that the css margin center in ie6 fails.

Of course, sometimes we need to solve css compatibility issues in browsers, especially ie, we may choose css hack. Compared with css hack, it is easier to select the correct DOCTYPE to Implement css compatibility. As long as we select a proper DOCTYPE and css write standards, the chances of browser compatibility problems will be reduced.

Most of the DTD types in DOCTYPE currently use the Transitional type. Generally, this DOCTYPE will be used when you create HTML using specialized web page creation software.

However, the newly created JSP (AdvancedTemplate) page in myeclipse does not use this DOCTYPE (not specified by DTD), which may cause browser compatibility problems, to avoid this problem, we 'd better use a common format.

When we select Jsp (Basic Templates) when creating JSP in myeclipse, we can choose which template page to use. If this option is not found in the new item, click window-> Customize Perspective and select new under it. Select jsp (BasicTemplate) and click OK.


In this way, we can customize a suitable JSP template, and then use our own template when creating a new JSP.

Open preferences, expand JSP on the left-> JSP Template, click the new option in the window on the right to fill in the relevant information, and save it:


On the newly created JSP page, select JSP (Basic Template) and click next to select the JSP Template to be used, and then click finish. You do not need to select a template next time. The system will use the previous template.

The code for creating a JSP page is as follows:
[Html]
<% @ Page language = "java" import = "java. util. *" pageEncoding = "UTF-8" %>
 
 
Www.2cto.com
 
Insert title here 
 
 
 
 
 
Author: jdluojing

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.