org.apache.bsf.BSFException: JavaScript Error: missing name after .@
(/report3.jsp#208)
org.apache.bsf.engines.javascript.JavaScriptEngine.handleError(Unknown
Source)
org.apache.bsf.engines.javascript.JavaScriptEngine.eval(Unknown Source)
org.apache.bsf.util.BSFEngineImpl.exec(Unknown Source)
org.apache.taglibs.bsf.scriptlet$1.run(scriptlet.java:101)
java.security.AccessController.doPrivileged(Native Method)
org.apache.taglibs.bsf.scriptlet.doEndTag(scriptlet.java:95)
I realize that class is a reserved word but this is going to be very
common and rather than have it become a FAQ that confuses everyone it
might be better to allow for it.
Regardless, here is the work-around:
//client.@class = "Organization"; //this causes and exception.
client.@tempclass = "Organization";
client.@tempclass.setLocalName("class");
Cheers,
McKinley
To use it do something like the following:
class MyContext extends Context
{
public boolean hasFeature(int featureIndex)
{
if (festureIndex
== FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER)
{
return true;
}
return super.hasFeature();
}
}
Then you need either explicitly construct MyContext and pass it to
Context.enter() or use custom ContextFactory:
class MyFactory extends ContextFactory
{
public Context makeContext()
{
return new MyContext();
}
}
and call once per application:
ContextFactory.initGlobal(new MyFactory());
Then Context.enter() will use MyContext.