diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java b/org.springframework.expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java index 000dde7e0e5..fb6251038b1 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +31,9 @@ public class TemplateParserContext implements ParserContext { private final String expressionSuffix; + /** - * Creates a new TemplateParserContext with the default #{ prefix and } suffix. + * Create a new TemplateParserContext with the default "#{" prefix and "}" suffix. */ public TemplateParserContext() { this("#{", "}"); diff --git a/spring-framework-reference/src/expressions.xml b/spring-framework-reference/src/expressions.xml index a26d05a7b0d..bbfc8f8019d 100644 --- a/spring-framework-reference/src/expressions.xml +++ b/spring-framework-reference/src/expressions.xml @@ -1015,28 +1015,28 @@ List placesOfBirth = (List)parser.parseExpression("Members.![placeOfBirth.city]" Expression templates allow a mixing of literal text with one or more evaluation blocks. Each evaluation block is delimited with prefix and suffix characters that you can define, a common choice is to use - ${} as the delimiters. For example, + #{ } as the delimiters. For example, String randomPhrase = - parser.parseExpression("random number is ${T(java.lang.Math).random()}", - new TemplatedParserContext()).getValue(String.class); + parser.parseExpression("random number is #{T(java.lang.Math).random()}", + new TemplateParserContext()).getValue(String.class); // evaluates to "random number is 0.7038186818312008" The string is evaluated by concatenating the literal text 'random - number is ' with the result of evaluating the expression inside the ${} + number is ' with the result of evaluating the expression inside the #{ } delimiter, in this case the result of calling that random() method. The second argument to the method parseExpression() is of the type ParserContext. The ParserContext interface is used to influence how the expression is parsed in order to support the expression templating functionality. The definition of - TemplatedParserContext is shown below. + TemplateParserContext is shown below. - public class TemplatedParserContext implements ParserContext { + public class TemplateParserContext implements ParserContext { public String getExpressionPrefix() { - return "${"; + return "#{"; } public String getExpressionSuffix() {