Archive

Archive for January, 2009

Cutsomizing RichFaces skins

RichFaces comes with the following skins:

* DEFAULT
* plain
* emeraldTown
* blueSky
* wine
* japanCherry
* ruby
* classic
* deepMarine
* NULL

To use a skin, all you need to do is set the name in web.xml file:

org.richfaces.SKIN
ruby

Suppose you like the skin, but you want to make some small changes to it. Here is what to do.

1. Unzip richfaces-impl-3.2.x.GA.jar file. All the skin files are under META-INF/skin
2. Take the skin you want to modify and save it under a different name in resources folder for Maven developers or under class path for others. For example rubycustom.skin.properties
3. Open the file and change the parameter you need. For example

headerBackgroundColor=#FFFFFF

then just set the new skin in web.xml file:

org.richfaces.SKIN
mySkin

Save and restart the server.

Starting with RichFaces 3.2.1, this process has become simpler. You still create a new custom skin file under Java source, and specify which skin to extend:

baseSkin=ruby

this means the skin is based on ruby skin. Next, you just over write the parameter that you need. In this example, it would look like this:

baseSkin=ruby
headerBackgroundColor=#FFFFFF

Categories: Uncategorized

JSF can handle GET requests as any other Web Frameworks : using shale-view

1.  Add shale-view, shale-application and shale-core jars deprendcies  to your pom

2. Define Shale filter in web.xml

<filter>
<filter-name>shale</filter-name>
<filter-class>
org.apache.shale.application.faces.ShaleApplicationFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>shale</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

3. manage your managed beans in faces-config.xml

<managed-bean>

<managed-bean-name>backing</managed-bean-name>

<managed-bean-class>com.foo.BackingBean</managed-bean-class>

<managed-property>

<property-name>personId</property-name>

<value>#{param.personId}</value>

</managed-property>

</managed-bean>

4. Extend your managed bean with Shale AbstractViewController or ViewController  and write business logic in prerender method.

public class BackingBean implements ViewController {

private int personId;

public int getPersonId() { return this.personId; }

public void setPersonId(int personId) { this.personId = personId; }

public void prerender() {

// By the time you get here, personId has aready

// been converted and injected, so use it to go look

// up the relevant information

}

}

Categories: Uncategorized
Follow

Get every new post delivered to your Inbox.