Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8413885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:01:13+00:00 2026-06-10T01:01:13+00:00

I have a XHTML page in which there are four textboxes <h:column > <f:facet

  • 0

I have a XHTML page in which there are four textboxes

<h:column >  
    <f:facet name="header">  
       <h:outputText value="Start Date" />  
    </f:facet>
    <h:inputText id="startDate" value="#{sampleVO.startDate}" />
</h:column>         
<h:column >  
    <f:facet name="header">  
       <h:outputText value="End Date" />  
    </f:facet>
    <h:inputText id="endDate" value="#{sampleVO.endDate}" />
</h:column>        
<h:column >
    <f:facet name="header">  
        <h:outputText value="Start Date" />  
    </f:facet>
    <h:inputText id="startDate1" value="#{sampleVO.startDate}" />
</h:column>         
<h:column >  
    <f:facet name="header">
       <h:outputText value="End Date" />  
    </f:facet>
    <h:inputText id="endDate1" value="#{sampleVO.endDate}" />
</h:column>        

I need to put a validation on Start Date and End Date. If user enters some Start and End date in id=”startDate” & id=”endDate” lets say Start Date: “01/01/2012″ (1jan) and End Date: 01/31/2012 and if user enters some dates on id=”startDate1″ and id=”endDate1″ id=”startDate1″ should always be greater thn id=”endDate” i.e date Ranges should not Overlap

public class SampleServiceimpl implements SampleService {
    private List<SampleVO> listOfSample;

     //this function gets called when clicked on Submit button on XHTML page
     public Void submit() {
        // how can i call datesOverLaps function to check entered
        // start date and End date not overlapping, Also how to
        // display the error message on XHTML page using FacingContext
     }

     public boolean datesOverlaps(List<SampleVO> sampleVO) {
        final Date early = sampleVO.getStartDate();
        final Date late = sampleVO.getEndDate();

        for(SampleVO existing : sampleVO) {
            if(!(early.isAfter(existing.getEnd())) ||
                     (late.isBefore(existing.getStart()))){
                return true;
            }
        }
        return false;
    }
}

Not sure if the above boolean function is current and would work in the scenario.
Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:01:14+00:00Added an answer on June 10, 2026 at 1:01 am

    I spend 6 hours on this. But i solved it. My english is bad.

    1. Add binding atribute on dataTable, pointing to UIDData field in backingbean (Bind table)

       <h:dataTable value="#{narocilo.podatki}" id="tabela" var="podatek" border="0" bgcolor="#F6FAF0" style="width:100%;" cellspacing="0" cellpadding="2" headerClass="header" rowClasses="#{narocilo.rowClasses}"   columnClasses="align_left,align_right,align_center,align_right,align_right,align_center_konec" **binding="#{narocilo.podatkiData}"**>
      
    2. Before the end of form ad

      <h:inputHidden id="validator" **validator="#{narocilo.validateKolicinaCena}"** value="morabiti"/>
      
    3. validator method in backing bean

       public void validateKolicinaCena(FacesContext aContext,UIComponent aComponent,Object aValue) {
      
      int shrani_index = fPodatkiData.getRowIndex();
      
      UIComponent column_kol = fPodatkiData.getChildren().get(2);
      UIComponent column_cen = fPodatkiData.getChildren().get(5);
      
      for(int i=0; i<fPodatkiData.getRowCount(); i++) {
      
          fPodatkiData.setRowIndex(i);
      
          UIInput kolicina_input = (UIInput) column_kol.findComponent("kolicina");
          UIInput cena_input = (UIInput) column_cen.findComponent("cena");
      
          Object kolicina = kolicina_input.getLocalValue();
          Object cena = cena_input.getLocalValue();
      
          if(kolicina == null && cena != null) {
      
              kolicina_input.setValid(false);
      
              FacesMessage sporocilo = Sporocila.getMessage("si.alkimisticus.bitea.error", "javax.faces.component.UIInput.REQUIRED", null);
              sporocilo.setSeverity(FacesMessage.SEVERITY_ERROR);
      
              aContext.addMessage(kolicina_input.getClientId(aContext), sporocilo);
      
          } else if(kolicina != null && cena == null) {
      
              cena_input.setValid(false);
      
              FacesMessage sporocilo = Sporocila.getMessage("si.alkimisticus.bitea.error", "javax.faces.component.UIInput.REQUIRED", null);
              sporocilo.setSeverity(FacesMessage.SEVERITY_ERROR);
      
              aContext.addMessage(cena_input.getClientId(aContext), sporocilo);
      
          } else {
              kolicina_input.setValid(true);
              cena_input.setValid(true);
          }
      
      
      }
      
      fPodatkiData.setRowIndex(shrani_index);}
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xhtml page in which there can be 0 to 6 check
Here is my use cases. I have a login page which is /public/login.xhtml .
I have a XHTML-based page which contains admin information. The admin should be able
I have a JSF page which is outputting XHTML (from a facelet). One of
I have jsp page inside which am calling my xhtml page. Am mapping xhtml
I have a well formed XHTML page. I want to find the destination URL
In my xhtml page I have the following tag included: <f:view locale=#{languageBean.locale}> ... </f:view>
Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>
I have the following markup inside a master page <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server>
I have a sample.xhtml file which has few lines of javascript. This javascript will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.