1 package com.jcorporate.expresso.services.taglib; 2 3 66 67 import com.jcorporate.expresso.core.controller.Transition; 68 import org.apache.log4j.Logger; 69 70 import javax.servlet.jsp.JspException ; 71 import javax.servlet.jsp.tagext.TagSupport ; 72 import java.io.IOException ; 73 74 86 public class TransitionName extends TagSupport { 87 88 private static final Logger log = Logger.getLogger(TransitionName.class); 89 90 93 private String value; 94 95 96 public TransitionName() { 97 } 98 99 104 public String getValue() { 105 return value; 106 } 107 108 113 public void setValue(String value) { 114 this.value = value; 115 } 116 117 122 public int doEndTag() throws javax.servlet.jsp.JspException { 123 ELTagSupport support = ELTagSupport.getInstance(); 124 Transition result = (Transition) support.evaluate("value", this.getValue(), 125 Transition.class, 126 this, this.pageContext); 127 128 if (result == null) { 129 throw new JspException ("Unable to locate transition for expression: " + this.getValue()); 130 } 131 132 String writeValue = "button_" + result.getName(); 133 134 try { 135 pageContext.getOut().write(writeValue); 136 } catch (IOException ex1) { 137 log.error("I/O exception writing output value", ex1); 138 throw new JspException ("I/O error"); 139 } 140 141 return EVAL_PAGE; 142 } 143 144 } | Popular Tags |