Spring spel regex tutorial

Spring SpEL Regex: Spring SpEL provides the facility to support regular expressions using keyword “matches“. Syntax: #{‘value’ matches ‘regex’ } Example: RegexTest.java import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component;   @Component("regexTestBean") public class RegexTest { // Check if this is a digit or not? @Value("#{‘250’ matches ‘\\d+’ }") private boolean validDigit;   public boolean isValidDigit() { return validDigit; … Read more

Spring spel list map example

Spring SpEL List/Map: Spring spel provides the facility to get values from List or Map. It works same as in java. Example: MapListTest.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;   import org.springframework.stereotype.Component;   @Component("mapListTestBean") public class MapListTest { private Map<String, String> map; private List<String> list;   public MapListTest() { map = new HashMap<String, … Read more

Spring spel method invocation example

Spring SpEL method invocation: Spring spel provides the facility of method invocation i.e. execute method and inject the method returned value into property. Syntax: #{beanName.methodName} Example: Address.java import org.springframework.stereotype.Component;   @Component("studentClassBean") public class StudentClass { public String getClassName(){ return "MCA Final"; } }import org.springframework.stereotype.Component; @Component("studentClassBean") public class StudentClass { public String getClassName(){ return "MCA Final"; … Read more

Spring spel bean reference tutorial

Spring SpEL Bean Reference: Spring spel provides the facility to refer a bean and nested properties using a dot (.) symbol. Syntax: #{beanName.propertyName} Example: Address.java import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component;   @Component("addressBean") public class Address { @Value("Sec-A") private String street; @Value("122001") private int postcode; @Value("India") private String country;   public String getStreet() { return street; } … Read more

Spring spel variable example

StandardEvaluationContext: The StandardEvaluationContext is a class which implements EvaluationContext interface. It uses a reflection mechanism to resolve properties or methods. We can set a variable using the method setVariable on the StandardEvaluationContext. We can use this variable in the expression by using the syntax #variableName. Example: MulitplicationTest.java public class MulitplicationTest { int num1; int num2; … Read more

Spring spel ternary operator example

Ternary operator syntax: condition ? true : false Spring SpEL Ternary Operator Example: TernaryOperatorTest.java import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser;   /** * Spring SPEL Ternary Operator test example. * @author w3schools */ public class TernaryOperatorTest { public static void main(String args[]){ //Create a parser with default settings. ExpressionParser parser = new SpelExpressionParser();   //Ternary operator expressions. … Read more

Spring spel operators example

Spring SpEL Operators: SpEL supports the mathematical operators (+, -, /, *, Spring SpEL Operators Example: OperatorTest.java import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser;   /** * Spring SPEL Operator test example. * @author w3schools */ public class OperatorTest { public static void main(String args[]){ //Create a parser with default settings. ExpressionParser parser = new SpelExpressionParser();   //Arithmetic … Read more

Spring spel hello world example

Spring SpEL: The SpEL stands for Spring Expression Language. It is a powerful expression language which supports querying and manipulating an object graph at the bean creation time or run time. It is similar to other expression languages like JSP EL, OGNL, MVEL and JBoss EL etc with some additional features like method invocation and … Read more

Spring spel tutorial

Spring SpEL: The SpEL stands for Spring Expression Language. It is a powerful expression language which supports querying and manipulating an object graph at the bean creation time or run time. It is similar to other expression languages like JSP EL, OGNL, MVEL and JBoss EL etc with some additional features like method invocation and … Read more

Jsf composite components tutorial

JSF provides the facility to create reusable custom components also known as composite components. Below are the steps to create composite components in JSF. Steps to create and use the JSF composite components: 1. First create a resources folder. 2. Create an xhtml file in resources folder and declared the composite namespace. 3. Uses composite … Read more

Categories JSF