Bug in Primefaces

UI Components for JSF
Post Reply
Steff
Posts: 20
Joined: 19 Apr 2011, 15:17

13 Jul 2011, 13:38

Hi,

I'm building a form that let the user enter database connection parameters. Once the parameters are typed
the user can test (btnTester) if connection can be established with its parameters.

In all cases, a message is produced for the user. Here the example of a failed connection attempt from backing bean code :

Code: Select all

(...)
   addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Connection failed.", t.getLocalizedMessage()));
(...)
Here is the form code. I'd like the message to appear in a p:message. Unfortunately, nothing happen.
No message (connection successful or not) is displayed after the button :\
Even with the global attribute set to false or true.

Code: Select all

<h:form>
(...)
                        <h:panelGrid>
                             <!-- Other form components here -->
                            <f:facet name="footer">
                                <p:commandButton
                                    id="btnTester"
                                    value="Tester"
                                    actionListener="#{assistantCreationSourcesBean.testerConnexionBase}" global="false" />
                                <p:message for="btnTester" />
                            </f:facet>
                        </h:panelGrid>
</h:form>
What am I missing ?
Last edited by Steff on 13 Jul 2011, 18:34, edited 1 time in total.
Image

Steff
Posts: 20
Joined: 19 Apr 2011, 15:17

13 Jul 2011, 18:12

I still struggle with that problem... knocking my head on all walls around me !
Image

smallya
Posts: 264
Joined: 19 Mar 2010, 19:22
Contact:

13 Jul 2011, 18:54

Try this

<p:commandButton
id="btnTester"
value="Tester"
actionListener="#{assistantCreationSourcesBean.testerConnexionBase}" global="false"
update="msg" />
<p:message id="msg"/>
Netbeans 7.2| GlassFish 3.2 | PostgreSQL 9.1| MongoDB | Primefaces 3.4.2
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit

Steff
Posts: 20
Joined: 19 Apr 2011, 15:17

13 Jul 2011, 19:01

I tried this code

Code: Select all

<h:form prependId="false">
(...)
                            <f:facet name="footer">
                                <p:commandButton
                                    id="btnTester"
                                    value="Tester"
                                    actionListener="#{assistantCreationSourcesBean.testerConnexionBase}"
                                    update="msgTester" />
                                <p:message id="msgTester" />
                            </f:facet>
(...)
</h:form>
I got this error :

Code: Select all

(...)
19:00:51,134 SEVERE [context] java.lang.NullPointerException
(...)
Image

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

14 Jul 2011, 08:32

smallya's suggestion is correct, you need to update the message by defining update attribute.

Regarding your stack trace, it just does not give anything useful info.

Steff
Posts: 20
Joined: 19 Apr 2011, 15:17

15 Jul 2011, 12:51

@Optimus If the for attribute is not present, I got this exception with no more details.
With smallya's solution, I still can't see the message :(
Image

Steff
Posts: 20
Joined: 19 Apr 2011, 15:17

15 Jul 2011, 14:43

In this post, I provide some information you may find useful :

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<partial-response>
    <changes>
         <update id="j_idt29:msgTester"><![CDATA[<div id="j_idt29:msgTester"></div>]]></update>
         <update id="javax.faces.ViewState"><![CDATA[-3746310992595862392:-5170446922525004407]]></update>
     </changes>
     <extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension>
</partial-response>
There is no text to display for msgTester :

Code: Select all

(...)
<div id="j_idt29:msgTester"></div>
(...)
EDIT
If I replace p:message by p:growl, It works, I get the message back .
But I still don't understand WHY I don't get my message back with p:message ...
Would you like the code to test it by yourself ?
Image

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 58 guests