Spring Boot与HTML

huangapple go评论79阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年10月21日 18:01:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/64461144.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定