If-Then-Else方法使用

parser.parseExpression("Name").setValue(societyContext, "IEEE");
societyContext.setVariable("queryName", "Nikola Tesla");
expression = "isMember(#queryName)? #queryName + ' is a member of the ' " + " + Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'";
String queryResultString =
    parser.parseExpression(expression).getValue(societyContext, String.class);
// queryResultString = "Nikola Tesla is a member of the IEEE Society"

你可能感兴趣的:(EL)