org.beetl.core.Tag Java Examples
The following examples show how to use
org.beetl.core.Tag.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlbianBeetlTemplateService.java From Albianj2 with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void loading() throws AlbianParserException { try { FileResourceLoader resourceLoader = new FileResourceLoader(c.getRootPath(), c.getCharset()); Configuration cfg = Configuration.defaultConfiguration(); cfg.setHtmlTagSupport(true); gt = new GroupTemplate(resourceLoader, cfg); StringTemplateResourceLoader rl = new StringTemplateResourceLoader(); sgt = new GroupTemplate(rl, cfg); Map<String, CustomTagConfigurtion> ctcs = c.getCustomTags(); for (Map.Entry<String, CustomTagConfigurtion> entry : ctcs.entrySet()) { CustomTagConfigurtion ctc = entry.getValue(); Class<? extends Tag> cla = (Class<? extends Tag>) AlbianClassLoader.getInstance().loadClass(ctc.getFullClassname()); if (null != cla) { gt.registerTag(ctc.getName(), cla); sgt.registerTag(ctc.getName(), cla); } } } catch (Exception e) { throw new AlbianParserException(e); } }
Example #2
Source File: BeetlConfiguration.java From MeetingFilm with Apache License 2.0 | 5 votes |
@Override public void initOther() { groupTemplate.registerFunctionPackage("shiro", new ShiroExt()); groupTemplate.registerFunctionPackage("tool", new ToolUtil()); groupTemplate.registerFunctionPackage("kaptcha", new KaptchaUtil()); groupTemplate.registerTagFactory("dictSelector", new TagFactory() { @Override public Tag createTag() { return dictSelectorTag; } }); groupTemplate.registerFunction("env", new Function() { @Override public String call(Object[] paras, Context ctx) { String key = (String)paras[0]; String value = env.getProperty(key); if(value!=null) { return getStr(value); } if(paras.length==2) { return (String)paras[1]; } return null; } protected String getStr(String str) { try { return new String(str.getBytes("iso8859-1"),"UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }); }
Example #3
Source File: HTMLTagSupportWrapper.java From beetl2.0 with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected void callTag(TagFactory tagFactory) { Tag tag = tagFactory.createTag(); tag.init(ctx, args, bs); tag.render(); }
Example #4
Source File: SpringBeanTagFactory.java From beetl2.0 with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * 返回上下文中对应Tag bean对象 * * @return */ @Override public Tag createTag() { return applicationContext.getBean(name, Tag.class); }