Examples of ActionSupport


Examples of com.opensymphony.xwork2.ActionSupport

    BigDecimal res = null;
    String mask = null;
    if (StringUtils.isNotEmpty(as[0])) {
      try {
        ActionSupport action =
          (ActionSupport) ActionContext.getContext().getActionInvocation().getAction();

        // najpierw RegEx
        String regEx = this.getRegEx(action);
        if (StringUtils.isNotEmpty(regEx)) {
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

    logger.debug("convertToString(Map=[{}], Object=[{}]) - start", map, obj);
   
    String res = obj != null ? obj.toString() : StringUtils.EMPTY;
    if (obj != null && obj instanceof BigDecimal) {
     
      ActionSupport action =
        (ActionSupport) ActionContext.getContext().getActionInvocation().getAction();

      String mask = this.getMask(action);
      DecimalFormat nf = new DecimalFormat(mask);
      res = nf.format((BigDecimal) obj);
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

    Date res = null;
    String mask = null;
    if (StringUtils.isNotEmpty(as[0])) {
      try {
        ActionSupport action =
          (ActionSupport) ActionContext.getContext().getActionInvocation().getAction();

        // najpierw RegEx
        String regEx = this.getRegEx(action);
        if (StringUtils.isNotEmpty(regEx)) {
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

    }
   
    String res = obj != null ? obj.toString() : StringUtils.EMPTY;
    if (obj != null && obj instanceof Date) {
     
      ActionSupport action =
        (ActionSupport) ActionContext.getContext().getActionInvocation().getAction();

      String mask = this.getMask(action);
      DateFormat df = new SimpleDateFormat(mask);
      res = df.format((Date) obj);
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

        assertFalse(verifyEmailValidityWithExpression("tmjee@yahoo.co", "\\b^[a-z]+@[a-z]+(\\.[a-z]+)*\\.com$\\b"));
    }

    protected boolean verifyEmailValidity(final String email) throws Exception {
        ActionSupport action = new ActionSupport() {
            public String getMyEmail() {
                return email;
            }
        };

        EmailValidator validator = new EmailValidator();
        validator.setValidatorContext(new DelegatingValidatorContext(action));
        validator.setFieldName("myEmail");
        validator.setDefaultMessage("invalid email");
        validator.setValueStack(ActionContext.getContext().getValueStack());
        validator.validate(action);

        return (action.getFieldErrors().size() == 0);
    }
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

        return (action.getFieldErrors().size() == 0);
    }

    public boolean verifyEmailValidityWithExpression(final String email, final String expression) throws Exception {
        ActionSupport action = new ActionSupport() {
            public String getMyEmail() {
                return email;
            }

            public String getEmailExpression() {
                return expression;
            }
        };

        EmailValidator validator = new EmailValidator();
        ValueStack valueStack = ActionContext.getContext().getValueStack();
        valueStack.push(action);
        validator.setValueStack(valueStack);

        validator.setValidatorContext(new DelegatingValidatorContext(action));
        validator.setFieldName("myEmail");
        validator.setDefaultMessage("invalid email");
        validator.setRegexExpression("${emailExpression}");

        validator.validate(action);
        valueStack.pop();

        return (action.getFieldErrors().size() == 0);
    }
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

        validator = verifyCaseSensitive(false);
        assertFalse(validator.isCaseSensitive());
    }

    private EmailValidator verifyCaseSensitive(final boolean caseSensitive) {
        ActionSupport action = new ActionSupport() {
            public boolean getEmailCaseSensitive() {
                return caseSensitive;
            }
        };
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

        validator = verifyTrim(false);
        assertFalse(validator.isTrimed());
    }

    private EmailValidator verifyTrim(final boolean trim) {
        ActionSupport action = new ActionSupport() {
            public boolean getTrimEmail() {
                return trim;
            }
        };
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

        ActionMessage err2 = new ActionMessage("error2", new Integer(1));
        ActionErrors errors = new ActionErrors();
        errors.add(errors.GLOBAL_MESSAGE, err1);
        errors.add("foo", err2);

        ActionSupport action = new ActionSupport();
        factory.convertErrors(errors, action);

        assertTrue(1 == action.getActionErrors().size());
        assertTrue(1 == action.getFieldErrors().size());
    }
View Full Code Here

Examples of com.opensymphony.xwork2.ActionSupport

            OgnlValueStack vs = new OgnlValueStack();
            vs.getContext().putAll(Dispatcher.getInstance().createContextMap(req, res, null, servletContext));
            ctx = new ActionContext(vs.getContext());
            if (ctx.getActionInvocation() == null) {
                // put in a dummy ActionSupport so basic functionality still works
                ActionSupport action = new ActionSupport();
                vs.push(action);
                ctx.setActionInvocation(new DummyActionInvocation(action));
            }
        }
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.