public class HttlRenderFactory implements IMainRenderFactory { public Render getRender(String view) { return new HttlRender(view); } public String getViewExtension() { return ".htm"; }}
public class HttlRender extends Render { private static final long serialVersionUID = 1012573049421601960L; private transient static final String encoding = getEncoding(); private transient static final String contentType = "text/html;charset=" + encoding; public HttlRender(String view) { this.view = view; } public void render() { try { Mapmap = new HashMap (); map.put("request", request); map.put("response", response); response.setContentType(contentType); Template template = Engine.getEngine().getTemplate(view); template.render(map, response); } catch (Exception e) { throw new RenderException(e); } }}
然后在Config中configConstant方法中添加:
me.setMainRenderFactory(new HttlRenderFactory());
在httl.properties中添加:
import.packages+=javax.servlet,javax.servlet.httpresolvers+=httl.spi.resolvers.ServletResolverinterceptors+=httl.spi.interceptors.ServletInterceptorout.converters+=httl.spi.converters.ResponseOutConverterimport.variables+=HttpServletRequest request,HttpServletResponse response,HttpSession session,ServletContext application,Map cookie,Map parameter,Map header
参考了,感谢!