Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Struts2 very simple validation doesn't work

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I have very simple validation from tutorial which doesn't work for me.
I have jsp with form (age, name) and want to perform some validation. The problem that my validation is ignored and nothing happens. Please take a look at that and give me some hints

--showMe.jsp--


--ShowMe.java--
Simple action that does nothing

--SaveMe.java--


--struts.xml--


-- SaveMe-validation.xml --


Every time I input any values the message "Saved!" appears, but I want some messages from validator. What is the problem???
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the validation file in the same package as the action?
 
Mike Nason
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the validation file is in the same place (folder, package as action files)
I just don't have any idea of where I am wrong
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see anything off the top of my head--are you sure the validation file is being deployed?

BTW, there's a "key" attribute that wraps up the label/name/value attributes and supports I18N automatically.
 
Mike Nason
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point!
Thanks!

The problem is that xml files is not included in .war file!
I use Maven2 and didn't do anything special configuration, just point in pom.xml

I should do something to point maven to include xml files as well in final war.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML files should be in src/main/resources/{package hierarchy}/filename. They'll be deployed/packaged if they're in there (as will properties files, etc.)
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic