Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

message required

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, is it possible to pass field's name for validator "required" so I to print next to field validation?
My code jsp
...
<h utputText value="USERNAME" /><h:message for="username" ></h:message>
<h:inputText id="username" value="#{user.username}" required="true"><h:message for="username" style="color: red" /></h:inputText>

My file with custum messages is:
...
javax.faces.component.UIInput.REQUIRED=Value is required.
...

I would that message is: Value for "username" is required.
Thanks.
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It takes some work, but this reference explains how to do it:
http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk7.html
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try

javax.faces.component.UIInput.REQUIRED=Value is required for {1}.
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I have tried both suggestions but I didn't resolve my problem, would you give me an other explanation, please?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What went wrong whem you tried what was suggested in the reference I posted?
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeff, now works even if not completely !!! Thanks very much your suggestion.
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm using PhaseListener, but why in my Application are showed both validation's errors (my personalize messages and default's messages)?
Thanks!
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!