em có tạo project bằng gradle controller của em return về file html nhưng mà nếu file htmt có thẻ input là lại báo lỗi có anh chị nào gặp trường hợp như này chưa ạ.
Project tạo bằng gradle controller, return về file html có thẻ input thì bị lỗi
Bạn show code của bạn theo format sau:
```
paste code vào đây
```
Sau đó paste hết dòng lỗi lên đây!
Mà thấy câu hỏi của bạn chả có phần liên quan gì đến java cả. Bạn dùng IDE nào? Đang dùng thư viện, framework nào? Mà mình nghĩ vấn đề của bạn nói như trên là bạn đang dùng spring framework trên IDE Intellij IDEA
Mình chỉ nghĩ được thế thôi! Nhớ reply sớm nhé
sorry vì mình nói không rõ ràng
tức là như này thằng controller của mình chỉ đơn giản return về file html
đây là controller cuuar mình
@SpringBootApplication
@Controller
public class DemowedApplication {
public static void main(String[] args) {
SpringApplication.run(DemowedApplication.class, args);
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public String demo(){
return "demo";
}
}
file html của mình là demo.html
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Getting Started: Serving Web Content</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="send">
<a href="click">click</a>
<button type="submit">click</button>
</form>
</body>
</html>
như này thì k vấn đề gì
nhưng mà nếu trong file html có thẻ input như là
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Getting Started: Serving Web Content</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="send">
<a href="click">click</a>
<button type="submit">click</button>
<input type="text" name="firstname" >
</form>
</body>
</html>
thì nó sẽ báo lỗi
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat May 05 13:51:40 ICT 2018
There was an unexpected error (type=Internal Server Error, status=500).
Exception parsing document: template="demoInput", line 12 - column 51
console nó bắn ra cái này
org.xml.sax.SAXParseException: The element type "input" must be terminated by the matching end-tag "</input>".
The element type “input” must be terminated by the matching end-tag “”
Câu này nó đã ghi rõ ràng rồi mà. Bạn đóng thẻ input lại là được
mình cũng đọc như thế xong thử đóng thẻ nhưng k được nhưng minh vừa thử lại thì ok
sory mọi người
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?