()
| 2331 | * that are not rtexpr, we can assume the body of the jsp:attribute is a template text. |
| 2332 | */ |
| 2333 | @Override |
| 2334 | public String getText() { |
| 2335 | |
| 2336 | class AttributeVisitor extends Visitor { |
| 2337 | private String attrValue = null; |
| 2338 | |
| 2339 | @Override |
| 2340 | public void visit(TemplateText txt) { |
| 2341 | attrValue = txt.getText(); |
| 2342 | } |
| 2343 | |
| 2344 | public String getAttrValue() { |
| 2345 | return attrValue; |
| 2346 | } |
| 2347 | } |
| 2348 | |
| 2349 | // According to JSP 2.0, if the body of the <jsp:attribute> |
| 2350 | // action is empty, it is equivalent of specifying "" as the value |
| 2351 | // of the attribute. |
| 2352 | String text = ""; |
| 2353 | if (getBody() != null) { |
| 2354 | AttributeVisitor attributeVisitor = new AttributeVisitor(); |
| 2355 | try { |
| 2356 | getBody().visit(attributeVisitor); |
| 2357 | } catch (JasperException e) { |
| 2358 | // Ignore |
| 2359 | } |
| 2360 | text = attributeVisitor.getAttrValue(); |
| 2361 | } |
| 2362 | |
| 2363 | return text; |
| 2364 | } |
| 2365 | } |
| 2366 | |
| 2367 | /** |
no test coverage detected