From: Marc P. <ma...@an...> - 2003-03-20 03:18:59
|
Hi all, I'm working against WM 1.1 final source, developing this WM "run and go" webapp currently codenamed "WebMacro Ignition". I've come across a funny. I can't -set-a property that has a binary accessor. A glance over the WM source for this (PropertyOperatorCache) has not enlightened me and the laptop I'm using is just toooo slow for interactive debug against Tomcat at the mo. Anyway, I'm getting this error in my template: Ignition encountered an error while executing a template: FileTemplate:C:\Program Files\Apache Group\Tomcat 4.1\webapps\ignition\WEB- INF\classes\index.wm: org.webmacro.PropertyException$NoSuchPropertyException: No public property Parameters on variable $action of class org.webmacro.ignition.api.action.ActionParams at C:\Program Files\Apache Group\Tomcat 4.1\webapps\ignition\WEB-INF\classes\index.wm:17.2 The part of the template causing offence is: #set $action.Parameters.Template = "itworked.wm" ...and $action is of type ActionParams which has the following methods: public void setParameters(String key, Object value) public String getParameters(String key) ... I know binary accessor "get" works as have used it elsewhere but this is the first time I've tried to "set" using it. Also, while binary accessor is certainly a convenience I'm starting to wonder whether it is a bit of an abomination. i.e. you cannot rewrite my previous bit of WM script as this: #set $params = $action.Parameters #set $params.Template = "itworked.wm" Well... you could if there was a "proxy" created to represent the virtual field "Parameters" internally in WM that handled this but it would be pretty nasty. Granted many web developers would not think of doing this, but it disturbs me that we can get ourselves into an inconsistent situation by using binary accessors. I think I may stop using them having realised this. $0.02 The webapp thing is coming along nicely though. I've got the meat of it done, and it's serving evaluated WM templates now. Doesn't sound like much but this is the tip of the iceberg, all the action mechanism stuff (including unlimited length action chains) is coded by not debugged. :-) I've also thrown in support for segregated "modules" where each module has its own WebMacro instance and therefore is separated from any others - i.e. a "WebMacro App Container" where you can deploy multiple webmacro "applications" without affecting any other code/templates. Best wishes, Marc -- Marc Palmer http://www.wangjammers.org |