The references to ScarabConstants are all just string constants. You can just replace them with strings. The TEMPLATE and NEXT_TEMPLATE constants are the names of the Intake keys for two form inputs that allow the action to be told by the form what screen to load in the case of failure or success. You can replace them with whatever you want provided you make sure that your intake.xml matches.

L.

Eigen Technology Pty Ltd wrote:

Here is another reply:

=======================================================
From: Everson Dave
Subject: Intake doc...
Date: Mon, 24 Sep 2001 13:22:38 -0500
Content-Type: text/plain;
 charset=iso-8859-1


ScarabConstants.INTAKE_TOOL equals the string "intake"

I had to grab the source to figure that out.
=====================================================

if that is the case, can I just subsititute intake for
ScarabConstants.INTAKE_TOOL ?

And also, what about ScarabConstants.NEXT_TEMPLATE and
ScarabConstants.TEMPLATE ?  What should they be replaced with?



compile:
    [javac] Compiling 2 source files to
/usr/local/tdk/webapps/medici/WEB-INF/classes
    [javac]
/usr/local/tdk/webapps/medici/WEB-INF/src/java/org/mycompany/medici/modules/actions/Test.java:26:
cannot resolve symbol
    [javac] symbol  : variable NEXT_TEMPLATE
    [javac] location: class org.apache.turbine.services.intake.IntakeTool
    [javac]                String template =
data.getParameters().getString(intake.NEXT_TEMPLATE,TurbineResources.getString("template.homepage",
"SelectedContact.vm") );
    [javac]
           ^
    [javac]
/usr/local/tdk/webapps/medici/WEB-INF/src/java/org/mycompany/medici/modules/actions/Test.java:33:
cannot resolve symbol
    [javac] symbol  : variable TEMPLATE
    [javac] location: class org.apache.turbine.services.intake.IntakeTool
    [javac]             setTemplate(data,
data.getParameters().getString(intake.TEMPLATE, "Login.vm"));
    [javac]







>This documents helps to clarify some of my quries. However, a variable
>in the Action code - ScarabConstants is undefined during Compilation. I
>checked the archive and got this:
>
>========================================================================
>ScarabConstants.INTAKE_TOOL is set to "intake" which is the handle given
>to the intake tool for use within templates.  The handle is set in
>TR.props.
>
>john mcnally
>========================================================================
>
>when John attempted to answer a question raised by Jonathan Porterfield.
>
>But I don't understand the Answer. Is John suggesting to add a line in
>TR.properties like this ?
>
>tool.request.intake=org.apache.turbine.services.intake.IntakeTool
>
>for ScarabConstants?
>
>
>cheers
>michael
>
>
>
>
>
>>There is an example form on the intake service document.  It is not
>>the how-to, but the docs for the service itself.  Here is a link to
>>the doc on the jakarta site...
>>http://jakarta.apache.org/turbine/turbine-2/services/intake-service.html
>>
>>Take a look at that.  It should answer the rest of your questions.  If
>>you have already been through that documents, let me know and I will
>>try explain it a little better.
>>
>>
>>>-----Original Message-----
>>>From: Eigen Technology Pty Ltd [mailto:[EMAIL PROTECTED]]
>>>Sent: Monday, December 23, 2002 6:08 AM
>>>To: [EMAIL PROTECTED]
>>>Subject: RE: Intake Example
>>>
>>>
>>>I am still a bit unclear... Below is the Test.java file I
>>>copied from intake-howto.html and my FORM.vm
>>>
>>>
>>>Q1: Does the name in FORM.vm
>>><-----   need to match that in
>>>
>>>   String username = (String)group.get("Username").getValue();  ?
>>>
>>>Q2: How is Group in Test.java file being used? It is not
>>>anywhere in my FORM.vm file?
>>>
>>>Q3: If the Action is successful, LoginSuccess.vm will be
>>>displayed, else Login.vm will be displayed?
>>>
>>>cheers
>>>micahel
>>>
>>>
>>>

>>>
>>>
>>> $intake.declareGroups()
>>>


>>>
>>>
>>>package org.mycompany.medici.modules.actions;
>>>import org.apache.velocity.context.Context;
>>>import org.apache.turbine.util.RunData;
>>>import org.apache.turbine.util.db.Criteria;
>>>import org.apache.turbine.modules.actions.VelocityAction;
>>>import org.mycompany.medici.om.Contact;
>>>import org.mycompany.medici.om.ContactPeer;
>>>import org.apache.turbine.services.intake.IntakeTool;
>>>import org.apache.turbine.services.intake.model.*;
>>>
>>>public class Test extends SecureAction
>>>{
>>>
>>>public void doLogin(RunData data, Context context)
>>>        throws Exception {
>>>       IntakeTool intake = (IntakeTool)context.get("intake");
>>>       Group group = intake.get("LoginGroup",
>>>IntakeTool.DEFAULT_KEY);
>>>if (!group.isAllValid()) {
>>>       //Log.debug("Group elements INVALID");
>>>       setTemplate(data, "Login.vm");
>>>       return;
>>>       } else {
>>>       setTemplate(data, "LoginSuccess.vm");
>>>       }
>>>       String username = (String)group.get("Username").getValue();
>>>String password = (String)group.get("Password").getValue(); }
>>>
>>>}
>>>
>>>
>>>
>>>
>>>
>>>
>>>>import org.apache.turbine.services.intake.IntakeTool;
>>>>import org.apache.turbine.services.intake.model.*;
>>>>
>>>>Btw - You class name of your action might need to be Test
>>>
>>>instead of
>>>
>>>>TEST.  You will want to follow the standard naming conventions for
>>>
>>>packages and class names for Turbine to correctly load the
>>>classes for
>>>
>>>>you.
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>From: Eigen Technology Pty Ltd
>>>
>>>[mailto:[EMAIL PROTECTED]]
>>>Sent: Monday, December 23, 2002 5:33 AM
>>>
>>>>>To: [EMAIL PROTECTED]
>>>>>Subject: RE: Intake Example
>>>>>
>>>>>
>>>>>I think I have followed things correctly.  In that action
>>>
>>>file, what
>>>
>>>>>packages do I need to import so that IntakeTool becomes
>>>
>>>part of it? I
>>>
>>>>>compile a file as given in the intake-howto, errors occur.
>>>>>
>>>>>compile:
>>>>>    [javac] Compiling 4 source files to
>>>>>/usr/local/tdk/webapps/medici/WEB-INF/cl
>>>>>asses
>>>>>    [javac]
>>>>>
>>>
>>>/usr/local/tdk/webapps/medici/WEB-INF/src/java/org/mycompany/medici/
>>>
>>>>>modules/actions/TEST.java:22: cannot resolve symbol
>>>>>    [javac] symbol  : class IntakeTool
>>>>>    [javac] location: class
>>>
>>>org.mycompany.medici.modules.actions.TEST
>>>
>>>>>[javac]        IntakeTool intake =
>>>>>(IntakeTool)context.get("intake");
>>>>>    [javac]        ^
>>>>>    [javac]
>>>>>
>>>
>>>/usr/local/tdk/webapps/medici/WEB-INF/src/java/org/mycompany/medici/
>>>
>>>>>modules/actions/TEST.java:22: cannot resolve symbol
>>>>>    [javac] symbol  : class IntakeTool
>>>>>    [javac] location: class
>>>
>>>org.mycompany.medici.modules.actions.TEST
>>>
>>>>>[javac]        IntakeTool intake =
>>>>>(IntakeTool)context.get("intake");
>>>>>    [javac]                             ^
>>>>>    [javac]
>>>>>
>>>
>>>/usr/local/tdk/webapps/medici/WEB-INF/src/java/org/mycompany/medici/
>>>
>>>>>modules/actions/TEST.java:26: cannot resolve symbol
>>>>>    [javac] symbol  : class Group
>>>>>    [javac] location: class
>>>
>>>org.mycompany.medici.modules.actions.TEST
>>>
>>>>>[javac]        Group group = intake.get("LoginGroup",
>>>>>IntakeTool.DEFAULT_KEY
>>>>>);
>>>>>
>>>>>
>>>>>>The intake.xml file should be located in your WEB-INF/conf
>>>>>
>>>>>directory.
>>>>>
>>>>>>For the action, the name of the calls should match the
>>>>>
>>>>>action name.
>>>>>
>>>>>>It should be located in your modules.actions package.  Make
>>>>>
>>>>>sure that
>>>>>
>>>>>>your setting for module.packages includes the name of your
>>>
>>>applications, modules as well as those for turbine.  For
>>>
>>>>>exmaple, if
>>>>>
>>>>>>your actions are under
>>>
>>>com.mycompany.sampleapp.modules.actions, the
>>>
>>>>>entry in TurbineResource.properties should read:
>>>>>
>>>>>>
>>>module.packages=com.mycompany.sampleapp.modules,org.apache.turbine.mo
>>>
>>>>>d
>>>>>
>>>>>>ul
>>>>>>es
>>>>>>
>>>>>>For all of the details on how actions work, look at the
>>>>>
>>>>>Velocity Site
>>>>>
>>>>>>how-to and the Action Events how-to.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>-----Original Message-----
>>>>>>>From: Eigen Technology Pty Ltd
>>>>>>>[mailto:[EMAIL PROTECTED]]
>>>>>
>>>>>Sent: Monday, December 23, 2002 4:42 AM
>>>>>
>>>>>>>To: [EMAIL PROTECTED]
>>>>>>>Subject: Intake Example
>>>>>>>
>>>>>>>
>>>>>>>I am learning how to use Intake. I am a bit confused by a
>>>>>
>>>>>couple of
>>>>>
>>>>>>>things.
>>>>>>>
>>>>>>>1. The intake.xml file, I checked in the archive about its
>>>>>
>>>>>location
>>>>>
>>>>>>>in the file system. Britta Ladwig-Attinger on 28th June 2001
>>>
>>>has
>>>
>>>>>posted this exact question, but it does not seem to be conclusive.
>>>
>>>So, where should this file be located? I have uncommented the three
>>>
>>>>>>>fields for Intake in TurbineResrouces.properties, tried adding
>>>
>>>a
>>>
>>>>>intake.xml file under app/WBE-INF/conf and "ant init" again. Don't
>>>
>>>know what to expect at this stage.
>>>
>>>>>>>2. The Action file used in the Intake howto, where should
>>>>>
>>>>>this file
>>>>>
>>>>>>>be located? and What should the .java file be named?
>>>>>
>>>>>Should I put it
>>>>>
>>>>>>>under ./src/java/org/mycompany/medici/modules/actions/
>>>
>>>and call
>>>
>>>>>>>it
>>>>>
>>>>>myAction.java ...
>>>>>
>>>>>>>thanks
>>>>>>>michael
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>--
>>>>>>>To unsubscribe, e-mail:
>>>>>>> [EMAIL PROTECTED]> For
>>>
>>>additional commands,
>>>
>>>>>>>e-mail:
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>To unsubscribe, e-mail:
>>>>> [EMAIL PROTECTED]>
>>>>>For
>>>>>additional commands,
>>>>>e-mail:
>>>>>
>>>>>
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>> [EMAIL PROTECTED]>
>>>For
>>>additional commands,
>>>e-mail:
>>>
>>>
>>
>>--
>>To unsubscribe, e-mail:
>> For additional
>>commands, e-mail:
>
>
>
>
>--
>To unsubscribe, e-mail:
> For additional
>commands, e-mail:





--
To unsubscribe, e-mail:
For additional commands, e-mail:


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

Reply via email to