Ahh nevermind the first mail, I managed to work around it. 

I still have a problem of not being able to access parameters via my prepare
method though. Here's my action class:

public class UserActions extends StrutsSupport implements Preparable {

   public void prepare()
   {
        if(id != null) //property is located in superclass StrutsSupport
                user= appManager.readUser(Long.valueOf(id));
   }

}

and the struts mapping:
<action name="update/user/*" 
                        class="net.myapp.web.UserActions">
     <interceptor-ref name="paramsPrepareParamsStack"/> 
     {1}
     <result>/models/user/update.jsp</result>
</action>

The whole flow is that when you access the above action the user object is
read and its values populate the form in update.jsp. But the id property is
never set so the form is never populated. I even tried setting
paramsPrepareParamsStack as the default stack but with no luck. 


meeboo wrote:
> 
> Hi all
> 
> I have a class for several actions and each action is mapped to a method,
> like this:
> 
> <action name="update/modelObject" 
>            class="net.myapp.web.modelObjectActions"
>            method="update">
> <result>/index.jsp</result>
> </action>
> 
> The above action will fire when a form is submitted and the modelObject
> properties are populated via the form fields. Now that I want is to invoke
> a prepare method before the update method so that I first can read the
> model object from the database and then populate its fields. I did
> implement preparable in modelObjectActions but then the prepare method
> will be invoked before all actions in that class, I want it to be invoked
> just for this specific action. 
> 
> Any ideas?
> 
> Thanks
> 

-- 
View this message in context: 
http://www.nabble.com/Running-a-prepare-method-before-the-assigned-action-method-tp16219260p16220742.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to