You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Wolfgang Schreiner <wo...@ec3.at> on 2005/07/13 10:52:16 UTC

incorrect display of error message

hi,

i would like to perform some validation checks on my web application. it 
works but always displays the error message twice

my jsp code:
            <h:commandButton value="#{msg.button_value}" 
action="#{login.login}"/>
            <h:outputText id="loginError" binding="#{login.component}" />
            <h:message for="loginError" style="color:red" 
showSummary="true" />

and the snippet from the login backing bean:
            context.addMessage(
                this.component.getClientId(context),
                new FacesMessage(bundle.getString("invalid_login"))
            );

the output for the loginError component is always "invalid 
username/password invalid username/password"
anyone encountered similar problems?

-- 
best regards,

  Wolfgang



RE: incorrect display of error message

Posted by Kris Verhoye <kr...@mediamine.com>.
Hey Wolfgang!

Glad to have helped somewhat ;-)

Using an empty string helps, but the root 'problem' regarding the message
attributes is this though:

The tag should not use the summary entry as detail entry if it can't find
the detail, and vice versa. Doing this, one always has to deactivate either
the detail or summary, if one message on the current page does not have a
detail or summary, or you will get message lines that seem to specify a
message twice...

Greetings,
Kris

-----Original Message-----
From: Wolfgang Schreiner [mailto:wolfgang.schreiner@ec3.at] 
Sent: woensdag 13 juli 2005 11:58
To: MyFaces Discussion
Subject: Re: incorrect display of error message

hi kris,

thanks a lot for the hint. i'll try out, but it already works fine with 
the solution from the other posting (and saves come code ;)).


--
best regards,

Wolfgang




Kris Verhoye schrieb:

>Hi Wolfgang,
>
>I have had the same problem regarding error messages. In my case it
>displayed every error twice in the messages list as well, using the
>h:messages tag. I'm now using this combo and that seems to work:
>
><h:messages globalOnly="true" styleClass="errors"/>          
><h:message for="loginInput" styleClass="errors"/>
>
>Whenever I use the globalOnly attribute (set to true) for the messages tag,
>it displays my messages only once. If I don't do that, it will display them
>twice (I don't know why though).
>
>As for the message tag: the fact that it displays the entry twice on one
>line is similar to having set the showDetail attribute of the h:message tag
>to true, which is the default. Try setting it to false, or specify an entry
>in your resource bundle in order to see if the system is using your primary
>entry as detail entry;
>
>For ex:
>
>Login_error=invalid username/password
>Login_error_detail=Please specify your correct login and password
>
>If the system can't find a detail entry, I noted that it will use the
>primary entry as detail.
>
>I hope this helps,
>Kris
>
>-----Original Message-----
>From: Wolfgang Schreiner [mailto:wolfgang.schreiner@ec3.at] 
>Sent: woensdag 13 juli 2005 10:52
>To: MyFaces Discussion
>Subject: incorrect display of error message
>
>hi,
>
>i would like to perform some validation checks on my web application. it 
>works but always displays the error message twice
>
>my jsp code:
>            <h:commandButton value="#{msg.button_value}" 
>action="#{login.login}"/>
>            <h:outputText id="loginError" binding="#{login.component}" />
>            <h:message for="loginError" style="color:red" 
>showSummary="true" />
>
>and the snippet from the login backing bean:
>            context.addMessage(
>                this.component.getClientId(context),
>                new FacesMessage(bundle.getString("invalid_login"))
>            );
>
>the output for the loginError component is always "invalid 
>username/password invalid username/password"
>anyone encountered similar problems?
>
>  
>



Re: incorrect display of error message

Posted by Wolfgang Schreiner <wo...@ec3.at>.
hi kris,

thanks a lot for the hint. i'll try out, but it already works fine with 
the solution from the other posting (and saves come code ;)).


--
best regards,

Wolfgang




Kris Verhoye schrieb:

>Hi Wolfgang,
>
>I have had the same problem regarding error messages. In my case it
>displayed every error twice in the messages list as well, using the
>h:messages tag. I'm now using this combo and that seems to work:
>
><h:messages globalOnly="true" styleClass="errors"/>          
><h:message for="loginInput" styleClass="errors"/>
>
>Whenever I use the globalOnly attribute (set to true) for the messages tag,
>it displays my messages only once. If I don't do that, it will display them
>twice (I don't know why though).
>
>As for the message tag: the fact that it displays the entry twice on one
>line is similar to having set the showDetail attribute of the h:message tag
>to true, which is the default. Try setting it to false, or specify an entry
>in your resource bundle in order to see if the system is using your primary
>entry as detail entry;
>
>For ex:
>
>Login_error=invalid username/password
>Login_error_detail=Please specify your correct login and password
>
>If the system can't find a detail entry, I noted that it will use the
>primary entry as detail.
>
>I hope this helps,
>Kris
>
>-----Original Message-----
>From: Wolfgang Schreiner [mailto:wolfgang.schreiner@ec3.at] 
>Sent: woensdag 13 juli 2005 10:52
>To: MyFaces Discussion
>Subject: incorrect display of error message
>
>hi,
>
>i would like to perform some validation checks on my web application. it 
>works but always displays the error message twice
>
>my jsp code:
>            <h:commandButton value="#{msg.button_value}" 
>action="#{login.login}"/>
>            <h:outputText id="loginError" binding="#{login.component}" />
>            <h:message for="loginError" style="color:red" 
>showSummary="true" />
>
>and the snippet from the login backing bean:
>            context.addMessage(
>                this.component.getClientId(context),
>                new FacesMessage(bundle.getString("invalid_login"))
>            );
>
>the output for the loginError component is always "invalid 
>username/password invalid username/password"
>anyone encountered similar problems?
>
>  
>


RE: incorrect display of error message

Posted by Kris Verhoye <kr...@mediamine.com>.
Hi Wolfgang,

I have had the same problem regarding error messages. In my case it
displayed every error twice in the messages list as well, using the
h:messages tag. I'm now using this combo and that seems to work:

<h:messages globalOnly="true" styleClass="errors"/>          
<h:message for="loginInput" styleClass="errors"/>

Whenever I use the globalOnly attribute (set to true) for the messages tag,
it displays my messages only once. If I don't do that, it will display them
twice (I don't know why though).

As for the message tag: the fact that it displays the entry twice on one
line is similar to having set the showDetail attribute of the h:message tag
to true, which is the default. Try setting it to false, or specify an entry
in your resource bundle in order to see if the system is using your primary
entry as detail entry;

For ex:

Login_error=invalid username/password
Login_error_detail=Please specify your correct login and password

If the system can't find a detail entry, I noted that it will use the
primary entry as detail.

I hope this helps,
Kris

-----Original Message-----
From: Wolfgang Schreiner [mailto:wolfgang.schreiner@ec3.at] 
Sent: woensdag 13 juli 2005 10:52
To: MyFaces Discussion
Subject: incorrect display of error message

hi,

i would like to perform some validation checks on my web application. it 
works but always displays the error message twice

my jsp code:
            <h:commandButton value="#{msg.button_value}" 
action="#{login.login}"/>
            <h:outputText id="loginError" binding="#{login.component}" />
            <h:message for="loginError" style="color:red" 
showSummary="true" />

and the snippet from the login backing bean:
            context.addMessage(
                this.component.getClientId(context),
                new FacesMessage(bundle.getString("invalid_login"))
            );

the output for the loginError component is always "invalid 
username/password invalid username/password"
anyone encountered similar problems?

-- 
best regards,

  Wolfgang