struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amol Ghotankar <ghotankaru...@gmail.com>
Subject Re: RedirectAction Help!
Date Wed, 11 May 2011 02:55:02 GMT
Hi,

My experience say not always just getter & setters works.

So try to use

ActionContext -> get context -> getvalue stack. set
or
ActionContext -> get context -> getvalue stack. push

If only problem is formId not available to OGNL during redirect.

There any be some other issue which needs more investigation .

On Wed, May 11, 2011 at 4:31 AM, Teresa McGinley <tdmcginley@gmail.com>wrote:

> I am trying to send an id from one action to another and it seems to be
> sending a null.  Please assist and I am really at my wits end with this.
> How do I get the formId from the Listing to the QuestionListing?
>
> startInformation has a yourForm=41, when I click the Begin button I get the
> redirect to Questions.action with a null formId as shown...
>
> http://localhost:8080/IUNSurvey/survey/Questions.action?formId=
>
> startInformation.jsp has a button that calls redirect:
>
> <s:form action="beginQuestions">
> ...
> <s:submit type="submit" value="Begin" align="right"/>
>
>
> struts.xml
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE struts PUBLIC
>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>    "http://struts.apache.org/dtds/struts-2.0.dtd">
>
> <struts>
>    <constant name="struts.devMode" value="true" /> <!-- set to false for
> prod -->
>
>    <package name="" namespace="/survey" extends="struts-default">
>        <action name="Listing" class="actions.survey.Listing"
> method="display">
>            <result name="none">/views/survey/Listing.jsp</result>
>        </action>
>
>        <action name="startInformation" class="actions.survey.Listing">
>            <result
> name="success">/views/survey/startInformation.jsp</result>
>        </action>
>
>        <action name="beginQuestions" class="actions.survey.Listing"
> method="beginQuestions">
>            <result name="redirect" type="redirectAction">
>                <param name="actionName">Questions</param>
>                <param name="parse">true</param>
>                <param name="formId">${yourForm}</param>
>            </result>
>        </action>
>
>        <action name="Questions" class="actions.survey.QuestionListing">
>            <result name="none">/views/survey/Questions.jsp</result>
>        </action>
>
>    </package>
> </struts>
>
> exerpt from Listing.java
>
>    public String execute() {
>        selectedForm = services.getFormsById(yourForm);
>        return SUCCESS;
>    }
>
>    public String display() {
>        forms = services.getForms();
>        return NONE;
>    }
>
>    public String beginQuestions() {
>        return "redirect";
>    }
>
>    /**
>     * @return the yourForm
>     */
>    public Long getYourForm() {
>        return yourForm;
>    }
>
>
> exerpt from QuestionListing.java
>
> I have a getter/setter for formId
>
>    public String execute() {
>        currentQuestion = (services.getQuestionsByForm(getFormId()));
>        return SUCCESS;
>    }
>
>    public String display() {
>        setCurrentQuestion(services.getQuestionsByForm(getFormId()));
>        return NONE;
>    }
>    public void setFormId(Long formId) {
>        this.formId = formId;
>    }
>
>    public Long getFormId() {
>        return formId;
>    }
>



-- 


With Best Regards,

Amol Ghotankar
Technical Lead
Cursive Technologies Pvt. Ltd.
104, A1 Wing, W Sector,
Masulkar Colony, Ajmera,
Pimpri, Pune-18 INDIA
O: +91 2020 270 570
M: +91 9960 980 419
www.cursivetech.com


CURSIVE TECHNOLOGIES EMAIL NOTICE
The information contained in this email and any attachments is confidential
and may be subject to copyright or other intellectual property protection.
If you are not the intended recipient, you are not authorized to use or
disclose this information, and we request that you notify us by reply mail
or telephone and delete the original message from your mail system.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message