【发布时间】:2018-03-05 21:24:13
【问题描述】:
我正在尝试使用 spring-boot 解析一个简单的 index.html 文件。如果我输入 localhost:8080/index.html 它会解决,否则我会得到白色错误页面。
我已将它发布在 GIT 上;这是一个非常简单的应用程序:Git Hub Link
问题似乎出在模型上:
表单模型:
@Entity
@Table(name="applicant")
public class FormModel {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String name;
@Email
private String email;
@Size(min=2, max=200)
private String description;
public String getName() {
return name;
}
@Required
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
@Required
public void setEmail(String email) {
this.email = email;
}
public String getDescription() {
return description;
}
@Required
public void setDescription(String description) {
this.description = description;
}
}
家庭控制器:
@RestController
public class Home {
@RequestMapping(value = "/", method = {RequestMethod.GET, RequestMethod.POST} )
public ModelAndView index(){
ModelAndView modelAndView = new ModelAndView("/index.html");
return modelAndView;
}
}
【问题讨论】:
标签: spring-boot