Results 1 to 3 of 3
  1. #1
    rekha is offline Member
    Join Date
    Mar 2009
    Posts
    8
    Rep Power
    0

    Default Form validation in struts

    hai,

    I have to validate my forms whether all the inputs are filled in . how to check it using formbeans. I am working in netbeans 6.5.Please help me out

  2. #2
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    in your jsp page
    you need to use a tag like
    1.<bean message key = "login.username"> if you want to validate username

    2.then go to applicationresource.properties file and type login.username = Username

    3.then create a form bean with setter getter methods
    your validation in form bean should be like
    if(getUsername()== null || getUsername()<1)
    errors.add("name", new ActionMessage("error.username.required"));

    4. go to properties file again and type anywhere
    error.username.required=Enter your username

    until this part your validation is done.

  3. #3
    rekha is offline Member
    Join Date
    Mar 2009
    Posts
    8
    Rep Power
    0

Similar Threads

  1. [SOLVED] Struts 2 Integer Validation not working
    By piyu.sha in forum Advanced Java
    Replies: 2
    Last Post: 10-15-2008, 02:54 AM
  2. Struts validation
    By Jack in forum Web Frameworks
    Replies: 3
    Last Post: 10-06-2008, 01:54 AM
  3. enctype=multipart/form-data with form data in struts
    By vk_satheesh in forum New To Java
    Replies: 0
    Last Post: 09-19-2008, 01:48 PM
  4. Struts custom Validation
    By ganesan in forum Web Frameworks
    Replies: 0
    Last Post: 07-17-2008, 02:15 PM
  5. form validation
    By abhiN in forum New To Java
    Replies: 0
    Last Post: 03-07-2008, 08:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •