首页 > 解决方案 > 带有搜索值的属性类型中的 Eclipse 警告

问题描述

在 Eclipse 中,我怎样才能摆脱不必要的警告,例如:未定义的属性值搜索

<input id="xx" name="xx" type="search" value="" />

这是一个例子

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta charset="UTF-8" />
        <title>Insert title here</title>
    </head>
    <body>
        <input name="find" type="search" id="find" value="0" />
    </body>
</html>

如果我只是把

<!DOCTYPE html>

警告消失

如果我在复杂文件中进行相同的更改,警告不会消失,并且由于与 html5 不兼容而出现许多其他警告

标签: htmleclipsewarnings

解决方案


由于在 XHTML<input type="search" ... />无效,因此会显示警告。

避免它或更好地使用 HTML5(即使可以通过将Attributes > Undefined 属性值设置为Ignore在Project > Properties: Validation > HTML Syntax中停用此警告)。


推荐阅读