Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined attribute name (role) , eclipse

I have a following file structure

WebContent->bootstrap->

js

css

img

WebContent->index.jsp

None of the following two urls are helping to resolve undefined attribute error.

Undefined attribute name (data-toggle)

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">

<button type="submit" class="btn btn-default">Submit</button>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
<a href="#">Inbox <span class="badge">42</span></a>


</div>
<div class="jumbotron">
  <h1>Hello, world!</h1>
  <p>...</p>
  <p><a class="btn btn-primary btn-lg" role="button">Learn more</a></p>
</div>

<div class="dropdown">
  <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
    Dropdown
    <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
    <li role="presentation" class="divider"></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
  </ul>
</div>
</body>
</html>

Eclipse version details are listed below. Spring Tool Suite

Version: 3.6.1.RELEASE Build Id: 201408250818 Platform: Eclipse Luna (4.4)

Copyright (c) 2007 - 2014 Pivotal Software, Inc. All rights reserved. Visit http://spring.io/tools/sts

This product includes software developed by the Apache Software Foundation http://www.apache.org

like image 295
NNikN Avatar asked Oct 06 '14 02:10

NNikN


1 Answers

Your doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

is for HTML 4.01.

data-* attributes were added in HTML 5. The doctype for HTML 5 is basically either

<!DOCTYPE html>

or

<!DOCTYPE html SYSTEM "about:legacy-compat">

It's also quite possible that your IDE isn't aware of HTML 5 and its many changes.

like image 168
cvrebert Avatar answered Nov 09 '22 02:11

cvrebert