Problems using image with p:command

UI Components for JSF
Post Reply
burferd
Posts: 234
Joined: 01 May 2010, 16:15

15 Dec 2010, 06:37

Using JSf2, facelets, PF 2.2-rc2, Glassfish 3, Internet Explorsr 8

My login page has an image assigned to a p:commandButton.
Everything worked fine for PF2.0 and PF2.1, but it does not display when using PF 2.2-RC2.
The button is there, but there is no image.
This is the same no matter which theme I use.

The p:component is a part of a component.
Here is the .xhtml code.

Code: Select all

                <p:commandButton id="loginBtn" styleClass="loginBtn" type="image"
                                 image="/resources/Images/LoginBtn.jpg"
                                 update="loginComp:loginPnl"
                                 action="#{loginSessionBean.loginBut_action}"  />
The image exists in my project in the resources/Image directory.
There have been no code changes to the .xhtml code or the directory structure between PF2.1 and 2.2.

Here is the styleClass as defined in my CS file:

Code: Select all

.loginBtn {
    position: absolute;
    top: 165px;
    left: 0px;
    height: 31px;
    width: 177px;
} 
Has anyone else successfully used an image on a button within a composite component, using PF 2.2?
If so, could you post the .xhtml and any .css definitions you use?
Does anyone have a clue as to why the image does not display when using PF2.2?
Does PF2.2 support images on buttons?
Has the syntax for p:commandButton changed between PF2.1 and PF2.2?

Thanks.
Using PrimeFaces 3.4, Mojarra 2.1.6, Glassfish 3.1.2, NetBerans 7.2, Hibernate 3.2.5 (sometimes)
Windows 7.

Squalphin
Posts: 7
Joined: 08 Sep 2010, 09:42

15 Dec 2010, 09:55

I think that your code should look something like that:

Button:

Code: Select all

<p:commandButton id="loginBtn"
                 image="loginIcon"
                 update="loginComp:loginPnl"
                 action="#{loginSessionBean.loginBut_action}"  />
Css:

Code: Select all

.loginIcon {
    background-image: url('/resources/Images/LoginBtn.jpg') !important;
}

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 25 guests