01/10/2018, 15:42

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

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 ạ.

Aragami1408 viết 17:53 ngày 01/10/2018

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é

Quang Ict viết 17:43 ngày 01/10/2018

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

Getting Started: Serving Web Content
<form action="send">
<a href="click">click</a>
	<button type="submit">click</button>	
</form>

như này thì k vấn đề gì
nhưng mà nếu trong file html có thẻ input như là

Getting Started: Serving Web Content
<form action="send">
<a href="click">click</a>
	<button type="submit">click</button>	
      <input type="text" name="firstname" >
</form>

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 “”.

Luc viết 17:54 ngày 01/10/2018

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

Quang Ict viết 17:48 ngày 01/10/2018

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

Bài liên quan
0