Dashboard > WebWork > ... > FAQ > WebWork failed to grab parameters of sort link generated by DisplayTag
  WebWork Log In View a printable version of the current page.  
  WebWork failed to grab parameters of sort link generated by DisplayTag
Added by tm_jee, last edited by tm_jee on Mar 12, 2007
Labels: 
(None)

This is due to WebWork attempting to parse the link ( eg. http://localhost:8080/etg-webapp/secure/reports/byReviewer.action?d-4002248-s=2&etgId=2&etgId=2&d-4002248-o=1 ) using OGNL and OGNL treats eg. d-400248... as minus resulting in the undesired behaviour in dev mode.

The sollution would be to have WebWork action implements ParameterNameAware and filter out the offending parameter.

public class MyAction extends ActionSupport implements ParameterNameAware {

   /**
    * This method will filter out parameters that
    * start with "d-" followed by a numeric digit,
    *  because parameters of this form are generated by displayTag, 
    *  and are treated by webwork as an invalid OGNL expressions causing
    * webwork to throw an ognl.InappropriateExpressionException exception.  
    * Note that the exception is only thrown when webwork is set in devmode.  
    * However, to prevent this error, the ParameterNameAware interface has been
    * implemented which requires this method.
    * This method could be implemented more simply using java's regular expression 
    * support, but such an implementation may suffer from readability except for
    * people who are very strong in understanding java's RegEX semantics.
    */
    public boolean acceptableParameterName(String parameterName){
      boolean retVal = true;
      if(parameterName!=null && parameterName.startsWith("d-") )
		 if( parameterName.length()>2) {
			String thirdCharacter = parameterName.substring(2,3);
			if(StringUtils.isNumeric(thirdCharacter)){
				retVal = false;
			}
		}
      return retVal;
    }
 }

Special thanks to Richard Wallace and Philip Brown. The detailed dicussion is here

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators