Skip to content

Instantly share code, notes, and snippets.

@Alternative
public class ImplementerA implements ImplementerIntf{
@Override
public String showImplementer() {
return this.getClass().getName();
}
}
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<alternatives>
<class>com.incept.cdialternative.ImplementerC</class>
</alternatives>
</beans>
@Named
@RequestScoped
public class IndexBean implements Serializable {
@Inject
ImplementerIntf obj;
@incepttechnologies
incepttechnologies / flash1
Last active August 29, 2015 14:05
put a value in flash scope
<h:outputText style="color: blue; font-weight: bold" value="flash.i1= "/>
<h:inputText id="i1" label="Input1: " value="#{flash.i1}"></h:inputText>
@incepttechnologies
incepttechnologies / flash2
Created August 7, 2014 22:01
put a value in flash scope
<c:set target="#{flash}" property="i2" value="Incept"></c:set>
@incepttechnologies
incepttechnologies / flash3
Created August 7, 2014 22:02
put a value in flash scope
<h:outputText value="#{flash['i1']}"></h:outputText>
<h:outputText value="#{flash.keep.i2}"></h:outputText>
@incepttechnologies
incepttechnologies / flash4
Created August 7, 2014 22:14
read a value from flash scope
public String someViewAction() {
System.out.println("flashExampleBean.someViewAction called");
Flash fl = FacesContext.getCurrentInstance().getExternalContext().getFlash();
Set flSet = fl.keySet();
System.out.println("FL set size = " + flSet.size()
+ ", i1 value=" + fl.get("i1")
+ ", i2 value=" + fl.get("i2")
+ ", i3 value=" + fl.get("i3"));
return "index_1";
@incepttechnologies
incepttechnologies / sorting-initializeTable
Created October 9, 2013 18:27
method showing setup of TableView for Sorting.
private void initializeTable() {
personViewIdCol.setCellValueFactory(new PropertyValueFactory<Person, String>("Id"));
id.setGraphic(upImg);
personViewIdCol.setGraphic(id);
personViewIdCol.setSortable(false);
personViewNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("Name"));
personViewNameCol.sortTypeProperty().addListener(new ChangeListener<SortType>() {
@Override
public void changed(ObservableValue<? extends SortType> paramObservableValue, SortType paramT1, SortType paramT2) {
System.out.println("NAME Clicked -- sortType = " + paramT1 + ", SortType=" + paramT2);
@incepttechnologies
incepttechnologies / gist:6909893
Created October 9, 2013 22:51
TableView -initialize
public void initialize(URL url, ResourceBundle rb) {
System.out.println("initialize");
sort();
initializeTable();
pageCount = getPageCount(persons.size(), itemsPerPage);
System.out.println("pageCount=" + pageCount);
pagination.setPageCount(pageCount);
pagination.currentPageIndexProperty().addListener(new ChangeListener<Number>() {
@incepttechnologies
incepttechnologies / gist:6910468
Created October 9, 2013 23:38
TableView : sort
private void sort() {
//persons.sort((Person p1, Person p2) -> p1.id.compareTo(p2.id));
Collections.sort(persons, new Comparator<Person>() {
@Override
public int compare(Person t, Person t1) {
System.out.println(" comparator called");
return t.getId().compareTo(t1.getId());
}
});
}