자바 서블릿 웹 애플리케이션 용 콧수염 템플릿을 저장할 위치와 템플리트가있는 서블릿을 지정하는 방법을 이해하려고합니다. 파일 경로 등을 어떻게 설정합니까?자바 서블릿에서 콧수염 템플릿을 찾는 방법 및 위치
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
MustacheFactory mf = new DefaultMustacheFactory();
Mustache fromFile = mf.compile("template.mustache");
Example e = new Example(); e.variable = "this is some value!";
fromFile.execute(response.getWriter(), e);
}
이것은 내 코드입니다. 내 템플릿은 내 서블릿 파일과 같은 폴더에 있습니다.
juhu, 내가 정확히 필요한 것 : +1 – elrado