Thanks Raghu for such a quick reply. I too considered the two options that you've suggested. Option (a) does not work and I was avoiding storing info in session scope.
I'll try & explain the problem with option (a). The action which forwards to the JSP is a named SetupEditJobProfileAction. This action takes the value from the query string and stores the value in a hidden form field. The action that this JSP submits to is able to get this value from the form. But when there is a validation error, the set up action is not able to get the same value through the form. My only guess is that when there is an input error the form doesn't really get submitted. But I am still not sure if that's the case. Are you aware of any parameter of the action tag which could state if post validation the form is to be submitted or not? Regards, Shivani -----Original Message----- From: Raghu Kanchustambham [mailto:[EMAIL PROTECTED] Sent: 03 December, 2005 1:35 PM To: Struts Users Mailing List Subject: Re: Preserving the query string while validating a form & using dynamic initialization with DynaAction > Query 1: There are two approaches I can think of right now. You will need to "burn" this querystring information into (a) the form object or (b) the session. (a) If you are using dynaction form, then just adding another variable to hold the id0 in the config.xml definition should be less painful. But even if you are using the regular "typed" action form, then also it should not be too much of a trouble to add the extra parameter. You can then map this parameter to a hidden variable in your jsp. (b) Instead of reading the variable form querystring/request object, burn it in to the session and read it from there. You could have a helper function ( a getId0( ) ) which checks if the variable is in the query string then it returns from the request object, else it should look up the session. Prevalidation, it would find it in the the request object, post validation it can pick it up from the session. Be aware that the drawback of this approach is that the user may have contamination of this variable if she opens another window from the same browser (like a Ctrl N in internet explorer) which will share the same cookie and hence the same session. But this is true in all cases where you use session scoped variables. >Query 2: I doubt if you could do that! The xml config files are fairly static in my opinion. But I am just guessing. HTH, Raghu On 12/3/05, Shivani Sawhney <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Can someone please help solve the following problems? > > > > Query 1: > > > > I am trying to access an action through a hyperlink and provide some > parameters through query string. This action forwards to a JSP, whose > URL reads something like > http://servername:port/rd/masters/SetupEditJobProfileAction.do?id0=13. I > have added validations on this JSP through DynaValidator Framework. Now > if the user feeds some incorrect input, the user is taken to the same > JSP with the errors listed but the URL doesn't have the query string > attached anymore, i.e., the URL becomes something like, > http://servername:port/rd/masters/SetupEditJobProfileAction.do which is > causing errors in my code. > > > > Could someone please suggest how to keep the query string (request > parameters) intact even when validation errors are caught and displayed > on the JSP? > > > > > > Query 2: > > Can I use user defined classes while initializing form fields using Dyna > Action? > > E.g., Can I write something like, > > <form-bean name="ChangePasswordForm" > type="org.apache.struts.validator.DynaValidatorForm"> > > <form-property name="date" type="java.lang.String" > initial="rd.admin.DateFormat.getDate()"/> > > > > Any help will be much appreciated. > > Thanks in advance. > > Regards, > > Shivani > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]