Examples of ValueExpression


Examples of javax.el.ValueExpression

        Object locale = getStateHelper().get(PropertyKeys.locale);
        if (locale != null)
        {
            return (Locale)locale;
        }
        ValueExpression expression = getValueExpression(PropertyKeys.locale.toString());
        if (expression != null)
        {
            return (Locale)expression.getValue(getFacesContext().getELContext());
        }
        else
        {
            locale = getFacesContext().getApplication().getViewHandler().calculateLocale(getFacesContext());
View Full Code Here

Examples of javax.el.ValueExpression

        tag = new MockSetSupport(VALUE);
        tag.setPageContext(pageContext);
        tag.setVar(VAR);

        // verify mapper is checked and the mapped variable removed
        ValueExpression ve = createMock(ValueExpression.class);
        expect(vm.resolveVariable(VAR)).andReturn(ve);
        expect(vm.setVariable(VAR, null)).andReturn(ve);
        pageContext.setAttribute(VAR, VALUE, PageContext.PAGE_SCOPE);
        replay(pageContext, elContext, vm, ve);
        tag.doEndTag();
View Full Code Here

Examples of javax.el.ValueExpression

                            @Override
                            public Object run() throws Exception {
                                ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
                                ctx.setFunctionMapper(functionMap);
                                ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
                                return ve.getValue(ctx);
                            }
                        });
            } catch (PrivilegedActionException ex) {
                Exception realEx = ex.getException();
                if (realEx instanceof ELException) {
                    throw (ELException) realEx;
                } else {
                    throw new ELException(realEx);
                }
            }
        } else {
            ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
            ctx.setFunctionMapper(functionMap);
            ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
            retValue = ve.getValue(ctx);
        }

        return retValue;
    }
View Full Code Here

Examples of javax.el.ValueExpression

    public void testSetValue()
    {
        // set value of #{foo} to BAR via ValueExpression
        ELContext elContext = facesContext.getELContext();
        ValueExpression ve = application.getExpressionFactory()
                .createValueExpression(elContext, "#{foo}", String.class);
        ve.setValue(elContext, "BAR");
        assertEquals("BAR", externalContext.getRequestMap().get("foo"));
    }
View Full Code Here

Examples of javax.el.ValueExpression

    {
        // set value of #{foo} to BAR in request scope
        externalContext.getRequestMap().put("foo", "BAR");
        // resolve value of #{foo} via ValueExpression
        ELContext elContext = facesContext.getELContext();
        ValueExpression ve = application.getExpressionFactory()
                .createValueExpression(elContext, "#{foo}", String.class);
        Object value = ve.getValue(elContext);
        assertEquals("BAR", value);
    }
View Full Code Here

Examples of javax.el.ValueExpression

    {
        // set value of #{foo} to BAR in request scope
        externalContext.getRequestMap().put("foo", "BAR");
        // resolve value of #{foo} via ValueExpression
        ELContext elContext = facesContext.getELContext();
        ValueExpression ve = application.getExpressionFactory()
                .createValueExpression(elContext, "test #{foo}", String.class);
        Object value = ve.getValue(elContext);
        assertEquals("test BAR", value);
    }
View Full Code Here

Examples of javax.el.ValueExpression

    /** {@inheritDoc} */
    public Object evaluateExpressionGet(FacesContext context,
            String expression, Class expectedType) throws ELException
    {

        ValueExpression ve = getExpressionFactory().createValueExpression(
                context.getELContext(), expression, expectedType);
        return ve.getValue(context.getELContext());

    }
View Full Code Here

Examples of javax.el.ValueExpression

            .doPrivileged(new PrivilegedExceptionAction() {

              public Object run() throws Exception {
                                ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
                                ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
                ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
                                return ve.getValue(ctx);
              }
            });
      } catch (PrivilegedActionException ex) {
        Exception realEx = ex.getException();
        if (realEx instanceof ELException) {
          throw (ELException) realEx;
        } else {
          throw new ELException(realEx);
        }
      }
    } else {
            ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
            ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
            ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
            retValue = ve.getValue(ctx);
    }
    if (escape && retValue != null) {
      retValue = XmlEscape(retValue.toString());
    }
View Full Code Here

Examples of javax.el.ValueExpression

         */
        public void validateEL(ExpressionFactory ef, ELContext ctx)
                throws ELException {
            if (this.el != null) {
                // determine exact type
                ValueExpression ve = ef.createValueExpression(ctx, this.value,
                        String.class);
            }
        }
View Full Code Here

Examples of javax.el.ValueExpression

        if (facesContext == null) {
            throw new NullPointerException();
        }
        // RF-1073
        try {
            ValueExpression ve = getValueExpression("currentDate");
            if (ve != null) {
                ELContext elContext = facesContext.getELContext();
                if (ve.getType(elContext).equals(String.class)) {
                    DateTimeConverter convert = new DateTimeConverter();
                    convert.setLocale(CalendarHelper.getAsLocale(facesContext, this, getLocale()));
                    convert.setPattern(CalendarHelper.getDatePatternOrDefault(this));
                    ve.setValue(facesContext.getELContext(), convert.getAsString(facesContext, this, currentDate));
                    return;
                } else if (ve.getType(elContext).equals(Calendar.class)) {
                    Calendar c = CalendarHelper.getCalendar(facesContext, this);
                    c.setTime((Date) currentDate);
                    ve.setValue(elContext, c);
                    return;
                } else {
                    ve.setValue(elContext, currentDate);
                    return;
                }
            } else {
                setCurrentDate(currentDate);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.