public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException { DictManager dictManager = SpringUtil.getBean("dictManager"); String dictType = node.jjtGetChild(0).value(context).toString(); String dictGroupName = node.jjtGetChild(1).value(context).toString(); String dictItemValue = node.jjtGetChild(2).value(context).toString(); VelocityContext velocityContext = (VelocityContext) context .getInternalUserContext(); TinyVelocityContext tinyVelocityContext = (TinyVelocityContext) velocityContext .getChainedContext(); Context webContext = tinyVelocityContext.getContext(); Dict dict = dictManager.getDict(dictType, webContext); for (DictGroup dictGroup : dict.getDictGroupList()) { if (dictGroup.getName().equals(dictGroupName) && dictGroup.getItemList() != null) { for (DictItem item : dictGroup.getItemList()) { if (item.getValue().equals(dictItemValue)) { writer.write(item.getText()); return true; } } } } return false; }
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException { DictManager dictManager = SpringUtil.getBean("dictManager"); String dictType = node.jjtGetChild(0).value(context).toString(); String dictGroupName = node.jjtGetChild(1).value(context).toString(); String dictItemValue = node.jjtGetChild(2).value(context).toString(); VelocityContext velocityContext = (VelocityContext) context .getInternalUserContext(); TinyVelocityContext tinyVelocityContext = (TinyVelocityContext) velocityContext .getChainedContext(); Context webContext = tinyVelocityContext.getContext(); Dict dict = dictManager.getDict(dictType, webContext); for (DictGroup dictGroup : dict.getDictGroupList()) { if (dictGroup.getName().equals(dictGroupName) && dictGroup.getItemList() != null) { for (DictItem item : dictGroup.getItemList()) { if (item.getValue().equals(dictItemValue)) { writer.write(item.getText()); return true; } } } } return false; }