Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Struts validator question

Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a simple java bean class binded in an ActionForm, which is hooked up with a jsp page on front side. an input field in jsp page is a property of the bean class. for example, username or password. Now I want to use validator to validate user input. But inside validation.xml file, I don't know how to code the property value in <field> tag. Please see below. Normally the decleration shoud be like this

But since the username is binding in my bean class, so how do I code the property value? I tried followings but none works. or

Please help. Thank you so much.
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your first attempt (property="bean.username") should have worked. Does your validation work for other fields? It could be that there is some other problem preventing your validation from working. Did you remember to specify validate=true in the action mapping?

If you'd like help debugging this, include more information, such as relevant portions of your JSP and struts-config.xml file. Also tell us what happens. Does it just not display an error message when the field is left blank?
[ January 26, 2007: Message edited by: Merrill Higginson ]
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic