Announcement Announcement Module
Collapse
No announcement yet.
OGNL not recognizing String to String converter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • OGNL not recognizing String to String converter

    Hi all,

    I know this issue has been brought up in the past but I have not yet seen a solution. I want to register a String to String Webflow converter so that I can trim white space before binding to the model.

    Putting a breakpoint in the method below shows me that when binding a String to an int (for example) Ognl.setValue(...) will invoke the conversationService.executeConversion(...) method. However this method will not be invoked when binding a String to a String.

    In org.springframework.binding.expression.ognl.OgnlEx pression

    Code:
    public void setValue(Object context, Object value) {
    		try {
    			Map evaluationContext = Ognl.addDefaultContext(context, getVariables(context));
    			Ognl.setTypeConverter(evaluationContext, createTypeConverter());
    			Ognl.setValue(expression, evaluationContext, context, value);
    		} catch (NoSuchPropertyException e) {
    			throw new PropertyNotFoundException(context.getClass(), getExpressionString(), e);
    		} catch (OgnlException e) {
    			if (e.getReason() instanceof ValueCoercionException) {
    				throw (ValueCoercionException) e.getReason();
    			} else {
    				throw new EvaluationException(context.getClass(), getExpressionString(),
    						"An OgnlException occurred setting the value of expression '" + getExpressionString()
    								+ "' on context [" + context.getClass() + "] to [" + value + "]", causeFor(e));
    			}
    		}
    	}
    I haven't been able to find the source code for OGNL version 2.6.9 so I'm having a little difficulty finding out where exactly OGNL is ignoring the conversionService.

    Has anyone come across any solution to trimming white space from parameters before binding to the model?
Working...
X