01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.views.jsp.ui;
06:
07: import com.opensymphony.xwork.util.OgnlUtil;
08: import ognl.Ognl;
09: import ognl.OgnlException;
10:
11: /**
12: * @author Matt Ho <a href="mailto:matt@enginegreen.com"><matt@enginegreen.com></a>
13: * @version $Id: OgnlTool.java 1169 2005-09-02 05:14:35Z plightbo $
14: */
15: public class OgnlTool {
16: private static OgnlTool instance = new OgnlTool();
17:
18: private OgnlTool() {
19: }
20:
21: public static OgnlTool getInstance() {
22: return instance;
23: }
24:
25: public Object findValue(String expr, Object context) {
26: try {
27: return Ognl.getValue(OgnlUtil.compile(expr), context);
28: } catch (OgnlException e) {
29: return null;
30: }
31: }
32: }
|