• Post Reply Bookmark Topic Watch Topic
  • New Topic

ListShuttle in JSF 2.0

 
Sanjeevi Ms
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,


I have done this "ListShuttle" component in JSF 2.0.

Try it..
The Sources are:

.xhtml



<?xml version='1.0' encoding='UTF-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jstl/core">

<head>
<link href="../../css/main.css" rel="stylesheet" type="text/css" />
<style>
.pic {
margin-bottom: -4px;
margin-right: 2px;
}
</style>
</head>
<body class="contentBackground">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jstl/core">
<t:saveState value="#{collapsiblePanelBean}" />
<f:view>
<h:form id="createProposal">


<fieldset align="center">
<table width="100%">

<tr>
<td colspan="3"></td>
<td class="panelData" colspan="3"><rich:listShuttle
sourceValue="#{pedBean.lista1}" targetValue="#{pedBean.lista2}"
var="items" listsHeight="250" sourceListWidth="300"
targetListWidth="300" sourceCaptionLabel="List of PED"
targetCaptionLabel="Available PED">
<rich:column>
<hutputText value="#{items}" />
</rich:column>
</rich:listShuttle></td>
</tr>


</table>
</h:form>
</f:view>
</ui:composition>
</body>
</html>

Bean:


package com.starhealth.common;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name = "pedBean")
@RequestScoped
public class PedBean {

private List<String> lista1;
private List<String> lista2;

/**
* Default Constructor
*/
public PedBean() {

lista1 = new ArrayList<String>();
lista2 = new ArrayList<String>();

lista1.add("Ischaemic Heart Disease");
lista1.add("Hypertension");
lista2.add("Diabetes Mellitus");
lista2.add("Eye Disorder");

}

public List<String> getLista1() {
return lista1;
}

public void setLista1(List<String> lista1) {
this.lista1 = lista1;
}

public List<String> getLista2() {
return lista2;
}

public void setLista2(List<String> lista2) {
this.lista2 = lista2;
}
}

Regards,

Sanjeevi M,

Senior Software Developer
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!