Like I said .. I really doubt if you could do anything much in the xml
files. They are designed to be static! (unless ofcourse you want to
programatically modify them).

Let me tell you the standard way of doing things:

Let us say you are looking at a create use case. You would typically have a
preCreate action which does all the fetching of values of dropdowns and
filling in defaults etc. The initial value is some kind of default which can
be set in the xml only if it is non-variant! If it varies with the input or
is some function that needs to be evaluated, you will need to do it in the
preCreate action.

You can look at Struts-Dialogs if you want to for the CRUD action.. .where
the paradigm slightly changes. I have not yet used it yet ... but what I
understand from their site, its pretty cool and similar to event driven
programming paradigm as against the action driven paradigm of vanila struts
! :-)


cheers,
raghu

On 12/3/05, Shivani Sawhney <[EMAIL PROTECTED]> wrote:
>
>
> So Sorry, Raghu!
> The option (a) for Query 1 actually works............ Thanks a ton!
>
> In set up action, I was trying to get the values through
> "request.getParameter("id0")", changing it to "form.get("id0")" worked.
>
>
> About the 2nd query, when I write,
>
> <form-property name="date" type="java.lang.String"
> initial="rd.admin.DateFormat.getDate()"/>
>
> ...the text box displays "rd.admin.DateFormat.getDate()" literally. Is
> there any way that I could get the form value to be evaluated rather
> than just outputting it as is?
>
> 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]
>
>

Reply via email to