anybody know Struts ?
Roedy Green - 16 Nov 2005 12:47 GMT
>anybody know Struts ?
there must be at least eight.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 16 Nov 2005 12:48 GMT
On Wed, 16 Nov 2005 12:47:31 GMT, Roedy Green
<my_email_is_posted_on_my_website@munged.invalid> wrote, quoted or
indirectly quoted someone who said :
>there must be at least eight.
that is a punch line to an old joke.
"Think of all the people in the world worse off than you are ---"

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
> you mean i could place this code in the Action class ?
>
[quoted text clipped - 9 lines]
> return errors;
> }
yes you could do something like that but you would have to call it from the
'execute' method of your action, or just do it in the execute method, like
this:
public final ActionForward execute(
final ActionMapping mapping,
final ActionForm form,
final HttpServletRequest request,
final HttpServletResponse response) throws Exception {
MyFormBeanType myFormBean = (MyFormBeanType)form;
// note use of ActionMessages to avoid using the
// deprecated 'saveErrors(HttpServletRequest, ActionMessages)'
ActionMessages messages = new ActionMessages();
if ((myFormBean.getPerson() == null) || (myFormBean.getPerson().length() <
1)) {
messages.add("person", new
ActionMessage("ch03.hello.no.person.error"));
}
//maybe validate some additional fields here
if(messages.isEmpty()) {
// do normal stuff here
return mapping.findForward("success");
} else {
this.saveErrors(request, messages);
return mapping.findForward("failure");
}
}
> another question : should we use Struts validation.xml ? some people
> say its good ...some says it is not. what do you think ?
It's ok if you have forms with many fields that don't require complex
validation. I personally don't like it much, one reason being that there
isn't adequate syntax checking of the validation.xml file. If you have an
error in the xml, in some cases the field being validated will always pass
validation, with no other indication that something is wrong.
> is this true Struts also can do Client-side validation ?? !! ...how is
> that possible ? only javascript (no other language) does client side
> validation . How much correct it is ?
The Struts validator uses javascript to do client side validation, and
client side is optional.
I think you could use a good Struts book. Check out "Struts in Action" by
Ted Husted
gk - 17 Nov 2005 06:34 GMT
great answers. you are definitely a Struts guru.
> > you mean i could place this code in the Action class ?
> >
[quoted text clipped - 60 lines]
> I think you could use a good Struts book. Check out "Struts in Action" by
> Ted Husted