Yes, I do declare
Map sitemapParams = new HashMap();
in the action.
Sorry for the error.
Leona
> Hi All,
>
> I've gone through the samples and archives and still am having trouble
> getting return values from an Action.
>
> I followed the sample code for a simple action:
>
> public class GSLoginAction extends AbstractAction {
> public Map act (Redirector redirector,
> SourceResolver resolver,
> Map objectModel,
> String source,
> Parameters params) {
>
> String strUserID;
> String strPwd;
> String strPlayerID = "";
> Request request = ObjectModelHelper.getRequest(objectModel);
> strUserID = request.getParameter("userID");
> strPwd = request.getParameter("pwd");
>
> // do something with the request parameters here and set strPlayerID
>
> sitemapParams.put("playerID", strPlayerID);
> request.setAttribute("playerID", strPlayerID);
> if (// the right thing happened) {
> return sitemapParams;
> }else {
> return(null);
> }
> }
>
> It is defined in the sitemap under <map:actions>, pointing to the correct
> class file.
> The action is called from this pipeline fragment, which is attached to
> the "ACTION" button of a form with two text boxes, "userID" and "pwd".
>
> <map:match pattern="login">
> <map:act type="gs-login">
> <map:parameter name="use-request-parameters" value="true"/>
> <map:parameter name="userID" value="{1}"/>
> <map:parameter name="pwd" value="{2}"/>
> <map:redirect-to uri="summary">
> <map:parameter name="playerID" value="{playerID}"/>
> </map:redirect-to>
> </map:act>
> <map:redirect-to uri="gs"/>
> </map:match>
>
> I know that the action is running, and the parameters are passed in,
because
> of some debugging I did in the Java code. I seem to be getting something
> back, becuase if I enter correct values on the form, redirect
> to "summary" does happen. Otherwise it goes to "gs".
>
> <map:match pattern="summary">
> <map:generate src="gs.xml"/>
> <map:transform src="gs.xsl">
> <map:parameter name="use-request-parameters" value="true"/>
> <map:parameter name="pagename" value="summary"/>
> <map:parameter name="playerID" value="{1}"/>
> </map:transform>
> <map:transform src="default-html.xsl"/>
> <map:serialize type="html"/>
> </map:match>
>
> The problem is that "playedID" is not being passed to "summary". Do I
> simply have a syntax error in working with the parameter, or is it more
> complicated than
> that?
>
> Thanks very much,
> Leona
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>