The error message tells you the problem exactly:
/Attempt to resolve method: length() on undefined variable or class name:
scriptName : at Line: 4 : in file: eval stream : scriptName .length ( ) /
This means, that you cannot call this method (length()) on a "null" value.
In Groovy, a null or empty string evaluates to a boolean false value, so you
can just write:
/
if (scriptName) {
return "success";
}
/
G.Ben wrote
>
> When trying to see the URL, I get the following error message :
>
>
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://learning/widget/learning/LearningScreens.xml#ProcessEntityAccessBSF]:
> java.lang.IllegalArgumentException: Error running script at location
> [component://learning/webapp/learning/WEB-INF/actions/entityaccess/processEntityAccessBSF.bsh]:
> javax.script.ScriptException: Sourced file: eval stream : Attempt to
> resolve method: length() on undefined variable or class name: scriptName :
> at Line: 4 : in file: eval stream : scriptName .length ( )
> in eval stream at line number 4 (Error running script at location
> [component://learning/webapp/learning/WEB-INF/actions/entityaccess/processEntityAccessBSF.bsh]:
> javax.script.ScriptException: Sourced file: eval stream : Attempt to
> resolve method: length() on undefined variable or class name: scriptName :
> at Line: 4 : in file: eval stream : scriptName .length ( )
> in eval stream at line number 4)
>
> Thanks for replying
>
--
View this message in context:
http://ofbiz.135035.n4.nabble.com/Beanshell-tp4635129p4635133.html
Sent from the OFBiz - User mailing list archive at Nabble.com.