1 28 29 package com.caucho.jsp.java; 30 31 import com.caucho.jsp.JspParseException; 32 import com.caucho.vfs.WriteStream; 33 import com.caucho.xml.QName; 34 35 import java.io.IOException ; 36 import java.util.logging.Level ; 37 38 41 public class JspParam extends JspNode { 42 private static final QName NAME = new QName("name"); 43 private static final QName VALUE = new QName("value"); 44 45 private String _name; 46 private String _value; 47 48 51 public void addAttribute(QName name, String value) 52 throws JspParseException 53 { 54 if (NAME.equals(name)) { 55 _name = value; 56 57 if (hasRuntimeAttribute(value) || hasELAttribute(value)) 58 throw error(L.l("'name' attribute may not have a runtime value at {0}", 59 value)); 60 } 61 else if (VALUE.equals(name)) 62 _value = value; 63 else 64 throw error(L.l("`{0}' is an invalid attribute in <jsp:param>", 65 name.getName())); 66 } 67 68 71 public String getName() 72 { 73 return _name; 74 } 75 76 79 public String getValue() 80 { 81 return _value; 82 } 83 84 87 public void endElement() 88 throws Exception 89 { 90 if (_name == null) 91 throw error(L.l("jsp:param requires a 'name' attribute")); 92 93 if (_value == null) 94 throw error(L.l("jsp:param requires a 'value' attribute")); 95 } 96 97 100 public boolean hasScripting() 101 { 102 try { 103 return hasRuntimeAttribute(getName()) || hasRuntimeAttribute(getValue()); 104 } catch (Exception e) { 105 log.log(Level.WARNING, e.toString(), e); 106 return true; 107 } 108 } 109 110 115 public void printXml(WriteStream os) 116 throws IOException 117 { 118 throw new IOException (L.l("<jsp:param> does not have a direct xml.")); 119 } 120 121 126 public void generate(JspJavaWriter out) 127 throws Exception 128 { 129 throw error(L.l("<jsp:param> does not generate code directly.")); 130 } 131 132 137 public void generateEmpty() 138 throws Exception 139 { 140 throw error(L.l("<jsp:param> does not generate code directly.")); 141 } 142 } 143 | Popular Tags |