1 23 package org.infoglue.cms.workflow.taglib; 24 25 import javax.servlet.jsp.JspException ; 26 import javax.servlet.jsp.JspTagException ; 27 28 import org.infoglue.cms.controllers.kernel.impl.simple.CategoryController; 29 import org.infoglue.cms.entities.management.CategoryVO; 30 import org.infoglue.deliver.taglib.AbstractTag; 31 32 36 public class CategoryWithNameTag extends AbstractTag 37 { 38 41 private static final long serialVersionUID = 6455221936074988498L; 42 43 46 private String name; 47 48 51 public CategoryWithNameTag() 52 { 53 super(); 54 } 55 56 62 public int doEndTag() throws JspException 63 { 64 setResultAttribute(findCategory()); 65 return EVAL_PAGE; 66 } 67 68 74 private CategoryVO findCategory() throws JspException 75 { 76 try 77 { 78 final CategoryVO categoryVO = CategoryController.getController().findByPath(name); 79 return CategoryController.getController().findWithChildren(categoryVO.getId()); 80 } 81 catch(Exception e) 82 { 83 e.printStackTrace(); 84 throw new JspTagException (e.getMessage()); 85 } 86 } 87 88 93 public void setName(final String name) 94 { 95 this.name = name; 96 } 97 } 98 | Popular Tags |