Note that there are some explanatory texts on larger screens.

plurals
  1. POjsf converter p:calendar date
    primarykey
    data
    text
    <p>Which is the Java class type that a "p:calendar" component is supposed bounded to? (in order to implementing a converter for it).</p> <p>I thought it was <code>java.util.Date</code>, and so I have the following:</p> <pre><code>&lt;p:calendar id="fecha" value="#{catalogoController.criterios.fecha}" maxlength="10" size="10" locale="es" pattern="dd/MM/yyyy" navigator="true" showOn="button" showButtonPanel="true" /&gt; </code></pre> <p>And the property <code>catalogoController.criterios.fecha</code> is a <code>java.util.Date</code>.</p> <p>My custom converter:</p> <pre><code> @FacesConverter(forClass = java.util.Date.class) public class FechaDateConverter implements Converter { ... public Object getAsObject(FacesContext context, UIComponent component, String value) { log.info("getAsObject"); ... } ... } </code></pre> <p>I don't put here the code of the method because it's large. It checks for conditions and throws ConverterException with custom facesmessages, that I get from a custom properties file ("msjsConversion").</p> <p>But it doesn't work. When I input an incorrect date (for example "01/032011"), my <code>getAsObject</code> method isn't triggered (I know because its first log line is never reached). And the default message of conversion is showed as the facesmessage, not the one I get from my bundle "msjsConversion".</p> <p>I think the reason why it is not triggered is because the Java class to which the <code>p:calendar</code> is bound isn't a <code>java.util.Date</code> (which is the class for which I declared my converter).</p> <p>And so, I've checked that if I declare my converter with an ID:</p> <pre><code>@FacesConverter("fechaDateConverter") public class FechaDateConverter implements Converter { </code></pre> <p>and I put this in the <code>p:calendar</code> component:</p> <pre><code>&lt;f:converter converterId="fechaDateConverter" /&gt; </code></pre> <p>It works.</p> <p>So anyone knows which is the Java class of <code>p:calendar</code>? So that I could declare my converter for that class, and not use a converterId?</p> <p>Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload