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

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

}

}

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: