Hi there,

I tried to insert objects into the context objects (import 
org.apache.velocity.context.Context) and reference them on the action (.vm) screen, 
but they are never valid references.  

What I'm trying to do is simple, really:


_______________my Action__________________
package us.wachtel.webmail.modules.actions;

import org.apache.turbine.modules.Action;
import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
import us.wachtel.webmail.*;    

public class AddUser extends Action {
    public void doCreateUser(RunData runData, Context context) {
        runData.setMessage(new String("Hi there"));
        WachtelUser wachtelUser = new WachtelUser();
        wachtelUser.setUname("philip");
        wachtelUser.setFname("Philip");
        wachtelUser.setLname("Wachtel");
        
        try {
            wachtelUser.save();
        } catch (Exception e) {
            context.put("error", e.getMessage());
            
        }
        context.put("user", wachtelUser);
        //System.out.println("UserId is:" + wachtelUser.getUserId() + " and primary 
key is: " + wachtelUser.getPrimaryKey());        
    }

    public void doPerform(RunData runData) 
    throws Exception {
        // nothing happening here, move on please.
    }
}
____________________end Action_________________________

____________________AddUserConfirm.vm_____________________
Error, if any: $error<p/>

Message for testing: $data.Message<p/>

User ID is: $user.UserId<br/>
Primary key is: $user.PrimaryKey
___________________end AddUserConfirm.vm__________________

___________________URL I use to test action__________________
http://localhost:8081/webmail/servlet/webmail/template/AddUserConfirm.vm?action=AddUser&eventSubmit_doCreateUser
___________________end URL I use to test action__________________


____________________Response on page__________________
Error, if any: :null: 
Message for testing: $data.Message 

User ID is: $user.UserId
Primary key is: $user.PrimaryKey 

____________________end Response on page___________________



So, I'm confused.  

Thanks for the help.

Regards,

Philip


Reply via email to