#1274 Support EL in tag attributes

Adding support to EL in tag attributes

<font size="2" ${something ? 'class=\"red\"' : ''}>
	<c:out value="some value" />
</font>
This commit is contained in:
jordillachmrf
2018-08-01 16:27:40 +02:00
parent c598d3b049
commit 543aadad20
2 changed files with 16 additions and 2 deletions

View File

@@ -248,7 +248,7 @@ PARSER_END(JspParser)
<InTagState> TOKEN :
{
<ATTR_NAME: <IDENTIFIER> >
<ATTR_NAME: (<IDENTIFIER> | "${" (<QUOTED_STRING> | <TEXT_IN_EL>)* "}") >
| <TAG_END: ">" > : AfterTagState
| <DECL_END: ("?>" | "!>") > : AfterTagState
| <TAG_SLASHEND: "/>" > : AfterTagState

View File

@@ -29,7 +29,21 @@ public class JspParserTest {
"<span class=\"CostUnit\">$</span><span class=\"CostMain\">129</span><span class=\"CostFrac\">.00</span>");
Assert.assertNotNull(node);
}
@Test
public void testParseELAttribute() {
Node node = parse(
"<div ${something ? 'class=\"red\"' : ''}> Div content here.</div>");
Assert.assertNotNull(node);
}
@Test
public void testParseELAttributeValue() {
Node node = parse(
"<div class=\"${something == 0 ? 'zero_something' : something == 1 ? 'one_something' : 'other_something'}\">Div content here.</div>");
Assert.assertNotNull(node);
}
/**
* Verifies bug #311 Jsp parser fails on boolean attribute
*/