• 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
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin


Ranch Hand
Posts: 49
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
validation of multiple field
i have tried following code it doesn't work
kindly suggest!
my xhtml code:
<p:selectOneMenu id="findings" binding="#{findcomponent}" value="#{admin.rbean.findings[loop.index]}">
<f:selectItem itemLabel="Select" itemValue="Select" />
<f:selectItem itemLabel="Yes" itemValue="Yes" />
<f:selectItem itemLabel="No" itemValue="No" />
<f:selectItem itemLabel="NA" itemValue="NA" />
<f:attribute name="confirm" value="#{observation}" />
<font color="red">
<p:message for="findings" />
<p:inputTextarea id="observation" value="#{admin.rbean.observation[loop.index]}" validator="#{admin.validateName}" cols="30" rows="5" >
<f:attribute name="findcomponent" value="#{findcomponent}" />
<font color="red">
<p:message for="observation" />

public void validateName(FacesContext context,UIComponent toValidate,Object value) throws ValidatorException

String nameStr = (String) value;
UIInput emailComponent = (UIInput) toValidate.getAttributes().get("findcomponent");
String find = (String) emailComponent.getValue();
FacesContext context1=FacesContext.getCurrentInstance();
FacesMessage message1 = new FacesMessage("Enter the Observation!");
throw new ValidatorException(message1);

Saloon Keeper
Posts: 25650
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not only does this question not have anything to do with Hibernate, you already asked a question titled "hibernate" Which didn't have anything to do with Hibernate either. You will get more usable answers when your question title matches what you're actually interested in.

You can make your XML more readable if you use the "Code" button on the message editor, by the way.

Rule #1 in JSF: The more JSF-specific code you write, the more likely you're doing it wrong. JSF is designed to work with POJO code wherever possible and to intrude only minimally when it's required at all.

Related to that is that as a general rule, you shouldn't use "binding" on controls unless you intend to actively manipulate the page layout itself. Normal data interactions can be done (and done much simpler) by using the "value=" attribute. I think that there is zombie documentation out on the Internet that keeps people using bindings and actionlisteners when thy shouldn't.

You need to read up on how to code and wire in Validators, however.
Everybody's invited. Even this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic