Can you post your Action code? I'm having a hard time visualizing...

> -----Original Message-----
> From: Drew McAuliffe [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, November 12, 2003 2:49 PM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] ModelDriven question
> 
> 
> I'm using the modeldriveninterceptor to populate the model 
> objects in my actions. For save and add operations, this 
> works fine. For loading operations, I'm having some problems. 
> My load code looks something like
> this:
> 
> this.model = saveCustomer(customer, session);
> 
> In this case, the "model" instance variable is the same thing 
> that gets returned from the "getModel()" method needed to 
> implement ModelDriven. Here's how it is declared in the class:
> 
> Customer model = new Customer();
> 
> The problem is that after the model instance is updated in 
> the action class, the updates aren't reflected in the value 
> stack. On a velocity result page, if I do 
> "$stack.findValue("name")" (assuming Customer has a getName() 
> property), I just get "name" back rather than the value. If I 
> call "$stack.findValue("top")", I get info about an empty 
> customer object (the "model" variable initialized for the new 
> action instance). If I call "$stack.findValue("model"), I get 
> info about the actual saved customer rather than the empty customer.
> 
> It looks like somehow the reference to the model class, 
> stored at the top of the stack thanks to the 
> ModelDrivenInterceptor, isn't reflecting changes to the model 
> object to which it was originally pointed. "top" in the stack 
> gets me the original model object before the save, and 
> "model" gets me the updated version. The interceptor pushes 
> into the stack on its "before" method, so I can understand 
> how the original, empty version gets in there, but I fail to 
> see how its not getting updated. How is this happening, if, 
> as I would expect, the reference on the stack is just an 
> object reference? Or, when things are put into the stack, are 
> they copied by value instead of by reference?
> 
> For now, I can just call "stack.push()" in my action after a 
> load, but this seems to be redundant and reflect something 
> missing in the ModelDrivenInterceptor. Should the interceptor 
> call the same code in it's "after" method (which is now 
> blank) as it does in its "before" method? Or is there some 
> other solution?
> 
> Thanks,
> 
> Drew
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by: ApacheCon 2003,
> 16-19 November in Las Vegas. Learn firsthand the latest 
> developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, 
> and more! http://www.apachecon.com/ 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to