英文:
Spring Boot with HTML
问题
我有一个Spring Boot应用程序。我想展示HTML。
index.html的位置如下
templete/view/index.html
Controller.java
@Controller
public class Controller {
@RequestMapping(value = "/view", method = RequestMethod.GET)
public String index() {
return "/view/index.html";
}
}
英文:
I hava Spring Boot Application.I want to show html.
index.html location is following
templete/view/index.html
Controller.java
@Controller
public class Controller {
@RequestMapping(value = "/view", method = RequestMethod.GET)
public String index() {
return "/view/index.html";
}
}
答案1
得分: 0
return "view/index";
在将来,您可能要考虑说明您预期会发生什么以及实际发生了什么,甚至更好的提供一个错误消息,这可能会给出一些提示,比如找不到您的文件。
英文:
return "view/index";
Should be what you need. In the future you might consider saying what you expect to happen and what actually happens, even better providing an error message which might give a hint like your file could not be found.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论