Lines 43-48
Link Here
|
43 |
import org.apache.jasper.Constants; |
43 |
import org.apache.jasper.Constants; |
44 |
import org.apache.jasper.JasperException; |
44 |
import org.apache.jasper.JasperException; |
45 |
import org.apache.jasper.JspCompilationContext; |
45 |
import org.apache.jasper.JspCompilationContext; |
|
|
46 |
import org.apache.jasper.compiler.Node.NamedAttribute; |
46 |
import org.apache.jasper.runtime.JspRuntimeLibrary; |
47 |
import org.apache.jasper.runtime.JspRuntimeLibrary; |
47 |
import org.xml.sax.Attributes; |
48 |
import org.xml.sax.Attributes; |
48 |
|
49 |
|
Lines 102-107
Link Here
|
102 |
|
103 |
|
103 |
private GenBuffer charArrayBuffer; |
104 |
private GenBuffer charArrayBuffer; |
104 |
|
105 |
|
|
|
106 |
private HashMap<NamedAttribute, String> variableNamesOfNamedAttributes; |
107 |
|
108 |
/** The {@code variableNameCounter} is used to generate different variable names for named attributes. */ |
109 |
private int variableNameCounter; |
110 |
|
105 |
/** |
111 |
/** |
106 |
* @param s |
112 |
* @param s |
107 |
* the input string |
113 |
* the input string |
Lines 819-825
Link Here
|
819 |
} |
825 |
} |
820 |
return v; |
826 |
return v; |
821 |
} else if (attr.isNamedAttribute()) { |
827 |
} else if (attr.isNamedAttribute()) { |
822 |
return attr.getNamedAttributeNode().getTemporaryVariableName(); |
828 |
return getVariableName(attr.getNamedAttributeNode()); |
823 |
} else { |
829 |
} else { |
824 |
if (encode) { |
830 |
if (encode) { |
825 |
return "org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(" |
831 |
return "org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(" |
Lines 3128-3134
Link Here
|
3128 |
public String generateNamedAttributeValue(Node.NamedAttribute n) |
3134 |
public String generateNamedAttributeValue(Node.NamedAttribute n) |
3129 |
throws JasperException { |
3135 |
throws JasperException { |
3130 |
|
3136 |
|
3131 |
String varName = n.getTemporaryVariableName(); |
3137 |
String varName = getVariableName(n); |
3132 |
|
3138 |
|
3133 |
// If the only body element for this named attribute node is |
3139 |
// If the only body element for this named attribute node is |
3134 |
// template text, we need not generate an extra call to |
3140 |
// template text, we need not generate an extra call to |
Lines 3183-3189
Link Here
|
3183 |
*/ |
3189 |
*/ |
3184 |
public String generateNamedAttributeJspFragment(Node.NamedAttribute n, |
3190 |
public String generateNamedAttributeJspFragment(Node.NamedAttribute n, |
3185 |
String tagHandlerVar) throws JasperException { |
3191 |
String tagHandlerVar) throws JasperException { |
3186 |
String varName = n.getTemporaryVariableName(); |
3192 |
String varName = getVariableName(n); |
3187 |
|
3193 |
|
3188 |
out.printin("javax.servlet.jsp.tagext.JspFragment " + varName |
3194 |
out.printin("javax.servlet.jsp.tagext.JspFragment " + varName |
3189 |
+ " = "); |
3195 |
+ " = "); |
Lines 3324-3329
Link Here
|
3324 |
if (isPoolingEnabled) { |
3330 |
if (isPoolingEnabled) { |
3325 |
tagHandlerPoolNames = new Vector(); |
3331 |
tagHandlerPoolNames = new Vector(); |
3326 |
} |
3332 |
} |
|
|
3333 |
|
3334 |
variableNamesOfNamedAttributes = new HashMap<NamedAttribute, String>(); |
3335 |
variableNameCounter = 0; |
3327 |
} |
3336 |
} |
3328 |
|
3337 |
|
3329 |
/** |
3338 |
/** |
Lines 3764-3769
Link Here
|
3764 |
} |
3773 |
} |
3765 |
|
3774 |
|
3766 |
/* |
3775 |
/* |
|
|
3776 |
* Returns the variable name of a named attribute. |
3777 |
*/ |
3778 |
private String getVariableName(NamedAttribute attribute) { |
3779 |
String name = variableNamesOfNamedAttributes.get(attribute); |
3780 |
if (name == null) { |
3781 |
name = Constants.TEMP_VARIABLE_NAME_PREFIX + (variableNameCounter++); |
3782 |
variableNamesOfNamedAttributes.put(attribute, name); |
3783 |
} |
3784 |
|
3785 |
return name; |
3786 |
} |
3787 |
|
3788 |
/* |
3767 |
* Generates the getter method for the given attribute name. |
3789 |
* Generates the getter method for the given attribute name. |
3768 |
*/ |
3790 |
*/ |
3769 |
private String toGetterMethod(String attrName) { |
3791 |
private String toGetterMethod(String attrName) { |