The signature for doAdd is wrong. I believe it should be:
public void doAdd(RunData, Context);
The API docs on VelocityActionEvent read:
If you are using VelocitySite stuff, then your Action's should extend
this class instead of extending the ActionEvent class. The difference
between this class and the ActionEvent class is that this class will
first attempt to execute one of your doMethod's with a constructor like
this:
doEvent(RunData data, Context context)
Also, your screen needs to have a link to that action - with the URL
you're giving, doPerform will be called because no action is specified.
(In other words, are you sure you want to call the NewUser action
before filling in values in some preliminary Screen?)
Will Stranathan
Shaun Campbell wrote:
> Hi
>
> Over christmas I have been trying to get to get to grips with Turbine and
> came up against the following problem trying to perform my "doAdd" action.
>
> I set up and got working Will's cdtrack example. In my template for this
> screen I added the following line:
>
> <input type="submit" name="eventSubmit_doAdd" value="Add User" >
>
> In my action java class file in Newuser.java I have the following methods:
>
> public class NewUser extends VelocityActionEvent
> {
> public void doAdd (RunData data) throws Exception
> {
> // put code here to add the user to the system
> Log.note("executing doAdd");
> data.setMessage("User Added!");
> }
>
> public void doPerform (RunData data) throws Exception
> {
> Log.note("executing doPerform");
> data.setMessage("Button not found!");
> }
>
> }
>
> Whenever I run pull up my screen using the following URL:
>
> http://localhost:8080/cdtrack/servlet/cdtrack/action/Newuser
>
> and then click on the "Add User" button all I ever get posted to my log file
> is the message about doPerform, but never doAdd.
>
> Can anyone suggest what I am doing wrong? I am right in thinking that the
> eventSubmit_doAdd entry in the template causes the doAdd method in the
> associated action class to be called?
>
> Thanks
>
> Shaun Campbell
>
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]