myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Andraschko (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Comment Edited] (MYFACES-4156) Myface is not showing the FacesMessage after validation when ValidatorException is thown.
Date Sun, 24 Sep 2017 18:58:00 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-4156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16178311#comment-16178311
] 

Thomas Andraschko edited comment on MYFACES-4156 at 9/24/17 6:57 PM:
---------------------------------------------------------------------

Works fine for me:


{code:java}
@FacesValidator(value = "blub")
public class MyValidator implements Validator<String>
{
    @Override
    public void validate(FacesContext fc, UIComponent uic, String t) throws ValidatorException
{
        if (t != null && t.length() > 32)
        {
            FacesMessage msg = new FacesMessage("Username should not exceed 32");
            throw new ValidatorException(msg);
        }
    }
{code}



and
{code:html}
                <h:form>
                    <h:messages showSummary="true"/>
                    <h:inputText value="#{myBean.text}" validator="blub"/>
                    <h:commandButton value="Submit"/>
                </h:form>
{code}
    


was (Author: tandraschko):
Works fine for me:

@FacesValidator(value = "blub")
public class MyValidator implements Validator<String>
{
    @Override
    public void validate(FacesContext fc, UIComponent uic, String t) throws ValidatorException
{
        if (t != null && t.length() > 32)
        {
            FacesMessage msg = new FacesMessage("Username should not exceed 32");
            throw new ValidatorException(msg);
        }
    }


and

                <h:form>
                    <h:messages showSummary="true"/>
                    <h:inputText value="#{myBean.text}" validator="blub"/>
                    <h:commandButton value="Submit"/>
                </h:form>
    

> Myface is not showing the FacesMessage after validation when ValidatorException is thown.
> -----------------------------------------------------------------------------------------
>
>                 Key: MYFACES-4156
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4156
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.3.0-beta
>            Reporter: Dora Rajappan
>
> Myfaces 2.3 is not showing the FacesMessage after validation when ValidatorException
is thrown. Same works with mojarra 2.2.
> if (param.length() > 32) {
> 		          FacesMessage msg = new FacesMessage("Username should not exceed 32");
> 		          
> 		          throw new ValidatorException(msg);
> 		      }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message