Taati,

This is a re-send in case it got buried somewhere in the
beta-alpha-who-cares discussion earlier. ;)

-----Original Message-----
From: Joseph Barefoot [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 3:01 PM
To: Struts Users Mailing List
Subject: RE: javascript and struts1.0.2


Well, if it works, I wouldn't worry about it too much--I'm not much of a
worrier by design, you see. ;)

The only difference between what I was suggesting and the way you're doing
it (I think) is where the actual Javascript resides.  I believe you are
putting it into the resource bundle for each error message you want to
output, and then creating an ActionError with the message ( already
containing the Javascript).

My suggestion was to put only the error message in the resource bundle, and
leave the Javascript in the JSP.  If your validation encounters errors,
create your ActionErrors object as you've been doing, but put the
ActionErrors object into the request with a key name (e.g. actionErrorsKey)
so you check for its existence.

Then in your JSP, you can do something like this:

<logic:present name="actionErrorsKey">
        onload(
                window.alert(  <html:errors/>  );
        )
</logic:present>


This way you could potentially re-use the error messages later since they no
longer contain any JavaScript.  If your implementation is satisfactory,
however, by all means stick with it.


peace,

Joe Barefoot


> -----Original Message-----
> From: Mannem, Taati [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 2:30 PM
> To: Struts Users Mailing List
> Subject: RE: javascript and struts1.0.2
>
>
> Joseph,
>       I am talking to Juan also and I think he is also suggesting the same
> way.The first problem I faced was I was using struts 1.0.2 and I
> didnt know
> how to do javascript handling part.So I used  that way to incorporate
> javascript alerts into my page and they sure seem to work fine.DO you have
> anyspecific example of which will give me the functionality you
> were talking
> abt .
> Thanks in advance.
>
> Regards,
> Taati
> > -----Original Message-----
> > From:       Joseph Barefoot [SMTP:[EMAIL PROTECTED]]
> > Sent:       Monday, May 13, 2002 4:52 PM
> > To: Struts Users Mailing List
> > Subject:    RE: javascript and struts1.0.2
> >
> > If it works, I'd say it's 'correct' enough. :)
> >
> > I'm not sure how you're doing this, but why not just write a
> custom tag or
> > do a <logic:present> to check for an ActionErrors object to see if there
> > are
> > errors.  If the tag evaluates to true, output your Javascript onload()
> > function, using <bean:message> tags to get the actual error message
> > text(s)
> > and insert them into the window.alert().  This way you only store the
> > error
> > message itself in the resource file, while the Javascript stays in your
> > JSP
> > page.  I've used Struts tags to modify the output of Javascript
> similarly,
> > and it works fine.
> >
> > Is this how you're currently doing it, and if not, is there a
> problem with
> > doing it this way?
> >
> >
> > peace,
> > Joe Barefoot
> >
> >
> > > -----Original Message-----
> > > From: Mannem, Taati [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, May 13, 2002 12:13 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: javascript and struts1.0.2
> > >
> > >
> > > Struts guys,
> > >   A help and review required urgently.I am using struts1.0.2 and I
> > > have to show the errors(validations ,ActionErrors) in the form of
> > > javascript
> > > alerts. I found  that struts 1.0.2 does not support javascript. I
> > handled
> > > this by writing the alerts in the applicationresources.properties and
> > that
> > > way I was within the framework and did not have to do much of
> extensive
> > > coding. Is this approach correct or is there some other better way?
> > > TIA
> > > Regards,
> > > Taati
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to