commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Muhammad Asif <muasi...@gmail.com>
Subject [validator] Re: Help Regarding Commons Validator to use it in servlets/jsp application
Date Thu, 11 Nov 2010 11:54:59 GMT
Dear All,

I have successfully done the following.

1. I made a form in jsp and posted it to a servlet
2. Inside the servlet i created a bean object and filled it up using the
form values retrieved from the request object.
3. I setup the validationresources object using an xml configuration file
4. I wrote a validator class extending from GenericValidator and i put
validateEmail method inside it
5. I performed the validation and processed the validation results

I have one question though to anybody more experienced to please tell me how
could i use the msg attribute of validator xml element. That is if i want to
display error messages on the jsp page if an error occurs how could i use
the error messages using the validator action etc.

Also i think perhaps i will need to do it manually as well that is i will
have to wire my error messages myself in the jsp and the validator action
msg attribute might not be of any benefit in my situation.

In struts usage though I can see the error messages are used via the
validator action.

In the end i will try to write down a complete example and will put on the
commons validator examples page.

Regards,
Asif

On Wed, Nov 10, 2010 at 6:45 PM, Mohammad Nour El-Din <
nour.mohammad@gmail.com> wrote:

> No problem :), I am sorry I have no direct answers to your questions
> this is why BeanValidation User Mailing list is the right place go
> look at :).
>
> On Wed, Nov 10, 2010 at 1:01 PM, Muhammad Asif <muasif80@gmail.com> wrote:
> > Ok thanks for your kind help though. I will look for these there.
> >
> > On Wed, Nov 10, 2010 at 5:59 PM, Mohammad Nour El-Din <
> > nour.mohammad@gmail.com> wrote:
> >
> >> Please ask these question on the user mailing of Apache Bean Validation
> :)
> >> .
> >>
> >> On Wed, Nov 10, 2010 at 12:54 PM, Muhammad Asif <muasif80@gmail.com>
> >> wrote:
> >> > Thank you very much Mohammad nour El-Din. I am taking a look at the
> >> > recommended link. Can you answer a few short questions.
> >> >
> >> > 1. Do we always need a bean based validation. I believe in this
> scenario
> >> we
> >> > must have to create a bean based on our form post
> >> > 2. Can we also use a validation framework or more appropriately is
> there
> >> a
> >> > validation framework which we can instantiate inside our servlet
> methods
> >> and
> >> > feed our form input data into it for validation.
> >> >
> >> >
> >> > Regards,
> >> > Asif
> >> >
> >> > On Wed, Nov 10, 2010 at 5:16 PM, Mohammad Nour El-Din <
> >> > nour.mohammad@gmail.com> wrote:
> >> >
> >> >> Hey :)
> >> >>
> >> >>   Take a look at this
> >> >> http://incubator.apache.org/bval/cwiki/index.html this is the new
> >> >> standard based Bean-Validation framework for both JSE and JEE.
> >> >>
> >> >> On Wed, Nov 10, 2010 at 11:41 AM, Muhammad Asif <muasif80@gmail.com>
> >> >> wrote:
> >> >> > Dear all,
> >> >> >
> >> >> > I am a good programmer and I also had SCJP 1.5 but unfortunately
> have
> >> not
> >> >> > worked on Java for a long time.
> >> >> >
> >> >> > At the moment I want to know how can we use commons validator
in a
> >> simple
> >> >> > servlet or jsp application without any other framework like struts,
> >> >> spring
> >> >> > or jsf.
> >> >> >
> >> >> > Can anyone point me to the correct place where I can see this.
> >> >> >
> >> >> > I have actually searched on the commons validator wiki and other
> >> places
> >> >> but
> >> >> > could not find an example or documentation explaining this in
> >> particular.
> >> >> > Perhaps my inexperience is one reason that I could not use this
> >> commons
> >> >> > validator based on the official documentation available.
> >> >> >
> >> >> > I am quite hopeful that I will get a good and helpful response
> soon.
> >> >> >
> >> >> > Regards,
> >> >> > Asif
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Thanks
> >> >> - Mohammad Nour
> >> >>   Author of (WebSphere Application Server Community Edition 2.0 User
> >> Guide)
> >> >>   http://www.redbooks.ibm.com/abstracts/sg247585.html
> >> >> - LinkedIn: http://www.linkedin.com/in/mnour
> >> >> - Blog: http://tadabborat.blogspot.com
> >> >> ----
> >> >> "Life is like riding a bicycle. To keep your balance you must keep
> >> moving"
> >> >> - Albert Einstein
> >> >>
> >> >> "Writing clean code is what you must do in order to call yourself a
> >> >> professional. There is no reasonable excuse for doing anything less
> >> >> than your best."
> >> >> - Clean Code: A Handbook of Agile Software Craftsmanship
> >> >>
> >> >> "Stay hungry, stay foolish."
> >> >> - Steve Jobs
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> >> For additional commands, e-mail: user-help@commons.apache.org
> >> >>
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Thanks
> >> - Mohammad Nour
> >>   Author of (WebSphere Application Server Community Edition 2.0 User
> Guide)
> >>   http://www.redbooks.ibm.com/abstracts/sg247585.html
> >> - LinkedIn: http://www.linkedin.com/in/mnour
> >> - Blog: http://tadabborat.blogspot.com
> >> ----
> >> "Life is like riding a bicycle. To keep your balance you must keep
> moving"
> >> - Albert Einstein
> >>
> >> "Writing clean code is what you must do in order to call yourself a
> >> professional. There is no reasonable excuse for doing anything less
> >> than your best."
> >> - Clean Code: A Handbook of Agile Software Craftsmanship
> >>
> >> "Stay hungry, stay foolish."
> >> - Steve Jobs
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >>
> >
>
>
>
> --
> Thanks
> - Mohammad Nour
>   Author of (WebSphere Application Server Community Edition 2.0 User Guide)
>   http://www.redbooks.ibm.com/abstracts/sg247585.html
> - LinkedIn: http://www.linkedin.com/in/mnour
> - Blog: http://tadabborat.blogspot.com
> ----
> "Life is like riding a bicycle. To keep your balance you must keep moving"
> - Albert Einstein
>
> "Writing clean code is what you must do in order to call yourself a
> professional. There is no reasonable excuse for doing anything less
> than your best."
> - Clean Code: A Handbook of Agile Software Craftsmanship
>
> "Stay hungry, stay foolish."
> - Steve Jobs
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message