一些启发
Here would be a couple of workaround solutions that you could choose from, if you don't find an actual Java expression evaluation library:
- Evaluate your expressions using XPath.
- Pros: XPath knows logical operators, and you can implement variables and custom functions using Xalan's extensions
- Cons: XPath has fewer types than Java
- Evaluate your expressions using JavaScript.
- Pros: Javascript is very flexible and will still be suitable when your requirements tighten. You can implement variables and custom functions using Javascript as well
- Cons: Javascript has fewer types than Java
- Evaluate your expressions using JSP's expression language (e.g. with JUEL)