Monthly Archive: February 2012

Feb 29

JSON Java & PHP

I want to show you how to get the value of the variable from php to java using JSON. JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate(wikipedia). First, you build your database and create a table. …

Continue reading »

Feb 23

Encapsulation

package exercise4; public class Telepon { private int durasi, tarif; private String kodeAsal, kodeTujuan, nomorAsal, nomorTujuan; public int ongkos() { if (kodeAsal.equals(kodeTujuan)) { tarif = 100; } else { tarif = 200; } return tarif * durasi; } public int getDurasi() { return durasi; } public void setDurasi(int durasi) { this.durasi = durasi; } public …

Continue reading »

Feb 17

JSF- Build Error Handling (Empty Input Fields)

1. First, you build the xhtml file

The correct label should be declared as:

and the correct error message should be declared as:

with “for” as same as “name” of the target. 2. and then build user.java

Feb 17

JSF #TAG

this tutorial will be about xhtml using list item using java class. First, you initialized the index.xhtml the dynamic value of form.yearItems. <h:selectOneMenu value=”#{form.yearOfBirth}” required=”true”> <f:selectItems value=”#{form.yearItems}” /> </h:selectOneMenu> 2. Initialized the java class for getYearItems (remember! variable for yearItems must be declared getYearItems) and then return to other variables (integer or String) public Collection<SelectItem> getYearItems() …

Continue reading »