Hi all, I am still struggling with the same problem , Did anybody have any solution/thoughts ?
I have a problem with forwarding the request to an action. I am using validations for the fields mention on the form , once validation fails as struts defined it will check for result name "Input". If the result name "Input" is defined with result type "redirect-action" as shown below , this will forward to the mention action with new request. <result name="input" type="redirect-action"> Is there any way where I can forward to an action , but still can use the old request object, throught will I can display the invalid values that user enter. I tried all the result type like : dispatcher --- Dispacther uses the old request object but the location must be a view not an action. Chain --- chain uses the old request object but it is excuted irrespective of what happen , life even if the validation pass chain is going to exucute. redirect -- same as redirect-action. Do anybody got such a problem earlier. ? Temp solution : I am setting the values in the session in the getter method of the object. and setting back to the new request removing it from the session. But i think this is a temp solution , there should be a direct solution where we can speicfy in resut-type like redirect with the old request object. Please any Inputs are highly appreicated. Siddiq Syed wrote: > > Hi , > > I think chain is not going to work for this kind of pattern. Because I > think chain will excute irrespective of what happens , even if validations > pass chain is going to call the action , which is not required in this > case. > > I am just wondering there should be a way where we can retreview the > values from the request like forward. > > Regards > Siddiq. > > > dusty wrote: >> >> The technical answer to your question is the "chain" result will copy the >> previous request. >> >> I think there could be some pattern issues here though. You have a >> central action where you post a variety of forms and you want to reuse >> that action and then figure out which form to go back to? >> >> I don't know the requirements behind the pattern so its hard to say if >> its better served some other way. Is it to type less? >> >> >> >> Siddiq Syed wrote: >>> >>> Hi Wes, >>> >>> Here is the configuration in struts.xml for displaying the result , >>> where we determine what need to be displayed once validation failed. >>> >>> If validation fails while "calculateParoleEligibilityDate" , then >>> framwork will look for input for the defined action which is >>> "determineInputForRedirect", which determine the corresponding view >>> which need to be display. >>> >>> Again the problem is "redirect-action" which leads to create a new >>> request , is there any way where i can redirect/forward to an action >>> which contains the previous request. >>> >>> <action name="calculateParoleEligibilityDate" >>> class="us.ga.state.pap.cons.clemency.presentation.action.activity.UpdateCaseAction" >>> method="calculateParoleEligibilityDate"> >>> <interceptor-ref name="redirectInput"/> >>> <result name="newsentence" type="tiles">editNewSentence</result> >>> <result name="additionalsentence" >>> type="tiles">editAdditionalSentence</result> >>> <result name="recomputation" type="tiles">editRecomputation</result> >>> <result name="revocation" type="tiles">editRevocation</result> >>> <result name="revocationnewconvict" >>> type="tiles">editRevocationNewConvict</result> >>> <result name="casedetail" type="tiles">updateCaseDetail</result> >>> <result name="combine" type="tiles">editProcessCombine</result> >>> <result name="input" type="redirect-action"> >>> determineInputForRedirect >>> ${caseNumber} >>> ${caseEditReason} >>> ${showButton} >>> ${taskId} >>> </result> >>> </action> >>> <action name="determineInputForRedirect" >>> class="us.ga.state.pap.cons.clemency.presentation.action.activity.UpdateCaseAction" >>> method="determineInputForRedirect"> >>> <result name="newsentence" type="tiles">editNewSentence</result> >>> <result name="additionalsentence" >>> type="tiles">editAdditionalSentence</result> >>> <result name="recomputation" type="tiles">editRecomputation</result> >>> <result name="revocation" type="tiles">editRevocation</result> >>> <result name="revocationnewconvict" >>> type="tiles">editRevocationNewConvict</result> >>> <result name="casedetail" type="tiles">updateCaseDetail</result> >>> <result name="combine" type="tiles">editProcessCombine</result> >>> </action> >>> >>> >>> Thanks in advance. I hope you got my problem. >>> >>> Regards, >>> Siddiq >>> >>> --- On Sat, 4/25/09, Wes Wannemacher <w...@wantii.com> wrote: >>> >>> >>> From: Wes Wannemacher <w...@wantii.com> >>> Subject: Re: result type -- redirect-action vs dispatcher. >>> To: "Struts Users Mailing List" <user@struts.apache.org> >>> Date: Saturday, April 25, 2009, 12:00 AM >>> >>> >>> On Friday 24 April 2009 19:47:04 Siddiq Syed wrote: >>>> Hi all, >>>> >>>> Problem statement. : >>>> >>>> When validation happens in struts 2 it will redirect to result type >>>> "Input" if type="tiles" JSP will display the validation message and If >>>> result type="redirect-action" , validation message will not get >>>> display.. In >>>> order to display validation messages , I am using interceptor where >>>> validation messages are will be stored in session and the same will be >>>> displayed in JSP. >>>> Problem is validation messages are getting displayed but the values are >>>> getting lost in the text boxs. The reason for this is because its the >>>> brand >>>> request object because of redirect-action. >>>> Is there any way where i can forward to action , but still can able to >>>> retrive the previous request. ? >>>> I know we can use dispacther , but dispacther uses only ".jsp" . >>>> >>> >>> I could be wrong, but i think redirectAction is the only result type >>> that ends >>> up with a new request... I don't really understand the use case where >>> validation fails and you want to go to input for a different action... >>> Can you >>> post your struts.xml section pertinent to this problem. >>> >>> -Wes >>> >>> -- >>> >>> Wes Wannemacher >>> Author - Struts 2 In Practice >>> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more >>> http://www.manning.com/wannemacher >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >>> >>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/result-type----redirect-action-vs-dispatcher.-tp23226596p23334687.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org