Pergunta

I have such Seam description for page:

<page xmlns="http://jboss.com/products/seam/pages"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd"

   login-required="true" conversation-required="false" no-conversation-view-id="/home.xhtml">
    <begin-conversation join="true"/>
    <param name="reportid" value="#{filter.reportIds}" />
    <navigation from-action="#{identity.logout}">
        <redirect view-id="/login.xhtml"/>
    </navigation>
</page>

I passed parameter reportid with URL http://localhost/home.seam?reportid=123 and I wonder which converter is used to convert it from string? I didn't found any information about default convertors for parameters.

Can someone know how this is works?

Foi útil?

Solução

If no specific converters are provided (and JSF is being used), Seam tries to infer the right converter from the destination property's class.

The Seam @Converter annotation provides the forClass parameter that tells Seam which type the converter produces. When registering converter components, Seam builds a list of default converters for each type. When a converter with no type is found, the target property's class is used to find an appropriate converter in this list.

If no Seam converter is found for the target type, then Seam delegates the election of an appropriate converter to the underlying JSF implementation. In the case of the JSF 1.2 RI, this returns one of the default converters for byte, boolean, short, int, long, float or double, if the target type is one of these. If no converter is found by the underlying JSF implementation, then an IllegalArgumentException is thrown.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top