开发者

Handling file not found on ftl page in Freemarker

How开发者_运维百科 can we handle the file not found exception on fileName.ftl file? So many have explained handling it on the action servlets. But I am not using any action servlet to load the freemarker. So no other option and I have to find a way to handle it on the template file itself..!


If the FileNotFoundException occurs during a FTL <#import> or <#include> inside your "main" FTL template, then I think you can catch the exception with FTL's attempt-recover-construct (similar to Java's try-catch). But if your "main" template cannot be found, then something outside of FreeMarker (e.g. the servlet which invoked FreeMarker) has to deal with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜