Posts Tagged ‘java’

JavaServer Faces Technology – JSF

Saturday, June 27th, 2009

JavaServer Faces technology is a server-side user interface component framework for Java technology-based web applications, its includes

  • A set of APIs for representing UI components and managing their state, handling events and input validation, defining page navigation, supporting internationalization and accessibility and providing extensibility for all these features.
  • A JavaServer Pages (JSP) custom tag library for expressing JavaServer Faces UI components within a JSP page and for wiring components to server-side objects

The well-defined programming model and tag libraries significantly ease the burden of building and maintaining web applications with server-side UIs. Here is the model:

One of the greatest advantages of JavaServer Faces technology is that it offers a clean separation between behavior and presentation. Web applications built using JSP technology achieve this separation in part. However, a JSP application cannot map HTTP requests to component-specific event handling nor manage UI elements as stateful objects on the server, as a JavaServer Faces application can. JavaServer Faces technology allows you to build web applications that implement the finer-grained separation of behavior and presentation that is traditionally offered by client-side UI architectures. The separation of logic from presentation also allows each member of a web application development team to focus on his or her piece of the development process, and it provides a simple programming model to link the pieces.

Another important goal of JavaServer Faces technology is to leverage familiar UI-component and web-tier concepts without limiting you to a particular scripting technology or markup language. Although JavaServer Faces technology includes a JSP custom tag library for representing components on a JSP page, the JavaServer Faces technology APIs are layered directly on top of the Servlet API.

Most importantly, JavaServer Faces technology provides a rich architecture for managing component state, processing component data, validating user input, and handling events.

For the most part, a JavaServer Faces application is like any other Java web application. A typical JavaServer Faces application includes the following pieces:

  1. A set of JSP pages (although you are not limited to using JSP pages as your presentation technology)
  2. A set of backing beans, which are JavaBeans components that define properties and functions for UI components on a page
  3. An application configuration resource file, which defines page navigation rules and configures beans and other custom objects, such as custom components
  4. A deployment descriptor (a web.xml file)
  5. Possibly a set of custom objects created by the application developer. These objects might include custom components, validators, converters, or listeners
  6. A set of custom tags for representing custom objects on the page

Java Tips: Class

Monday, May 18th, 2009

In object-oriented programming, a class is a programming language construct that is used as a blueprint to create objects. This blueprint includes attributes and methods that the created objects all share.

A class can represents a person, place, or thing as an abstraction of a concept within a computer program. Fundamentally, it encapsulates the state and behavior of that which it conceptually represents. It encapsulates state through data placeholders called member variables (or instance variables). It encapsulates behavior through reusable code called methods.

There is some rules associated with declaring classes in a source file [SCJP 1.6 Study Guide]:

  1. There can only one public class per source code file.
  2. If there is a public class in a file, the name of the file must match with the name of the public class.
  3. If the class is part of the package, the package statements must be the first line inte source code file before import statement that maybe present.
  4. If there are import statement, they must written between the package statement and the class declaration.
  5. A source code file can have more than one nonpublic class.

The following code is the bare-bones class declaration:

class MyFirstClass() {
  //.......
}

Ok, lets start to make a hello world class :)

public class MyHelloWorld() {
  private String greet = "Ehlo World";
  public void says() {
    System.out.println(greet);
  }
}

Oracle Buys Sun

Monday, April 20th, 2009

On April 20, 2009, Oracle announced it has entered into an agreement to acquire Sun Microsystems (Sun). The proposed transaction is subject to Sun stockholder approval, certain regulatory approvals and customary closing conditions. Until the deal closes, each company will continue to operate independently, and it is business as usual.

The acquisition combines best-in-class enterprise software and mission-critical computing systems. Oracle plans to engineer and deliver an integrated system—applications to disk—where all the pieces fit and work together so customers do not have to do it themselves. Customers benefit as their system integration costs go down while system performance, reliability and security go up.

taken from:

  1. http://www.oracle.com/index.html
  2. http://www.sun.com/third-party/global/oracle/index.jsp

Java Tips: Identifiers

Friday, April 10th, 2009

On java programming language, the name of classes, variables, methods called an identifier. Java has some rules about identifiers so that identifiers are legal for use.

Technically, legal identifiers must be composed of only Unicode Characters, number, curency character, and connecting character (like underscores).

Then, here are the rules you do need to know:

  1. Identifiers must start with letter, a curency character ($), or a connecting character. It is can’t start with a number.
  2. After the first character above, identifiers can contain any combination of  Unicode Characters, number, curency character, and connecting character.
  3. There is no limit to the number of characters an identifiers can contain.
  4. Can’t use java keywords as an identifiers
  5. Like the java programming languange habbit, the identifiers are case-sensitive.

Happy Coding… :)

Java Tips: Generic Type

Thursday, March 19th, 2009

When work on Java 5 environment or above, we usually found a suppress warning for our collection definition (List, ArrayList, Vector, HashMap, etc…). Different with Java 1.4 environment, its free for us to define HashMap contain with many type of object as its key and its value. On Java 5 we still can do that but it is caused warning when we compile the source. So we need to parameterized its HashMap.

With parameterized its HashMap, we can safe our code from any object missmatch. It’s mean that we prepare a specific bucket and then fill its bucket with apropriate contents. As example, the code below caused warning:

...
HashMap map = new HashMap();
...

Better we parameterized that HashMap with specific data type as a control for us when we assign value on it. For example we decide that the key of the HashMap is String and the value is String too, then the code should be like this:

...
HashMap map = new HashMap();
map.put("one", "Value is ONE");
map.put("two", "Value is TWO");
// map.put("three", 3); // its return an error
...

So when we want to access its value we shouldn’t wrong about the data type.

...
String val = map.get("one");
// Integer val = map.get("one");
// line code above will cause Error because type missmatch
...

When we don;t know exactly what kind of data type fetched, we can generalized its return as Object. And then, from fetched list we can decide what kind of object and its method contained.

...
// fetching
List result = sess.createQuery("from Event").list();
// Displaying
for (Object o : result) {
    if (o instanceof Event) {
        event = (Event) o;
        System.out.println(event.getTitle());
    }
}
...

Happy coding ;)

update for HashMap looping:

...
Iterator iter = hashMap.keySet().iterator();

while (iter.hasNext()) {
    String key = iter.next();
    String value = hashMap.get(key);
    System.out.println("Key ="+key+"\n Value"+value)
}
...

Aplikasi GWT-Ext dengan Eclipse

Saturday, August 2nd, 2008

Setelah kmaren nulis tentang GWT-Ext, sekarang waktunya berbagi tentang bagaimana cara pengembangan aplikasi GWT-Ext secara sederhana dengan bantuan IDE Eclipse. Btw udah pada ngerti kan eclipse?? kalo misal masih ada yang belom ngerti, silahkan kunjungi situs resminya di sini. Oke, sebelum proses installasi dimulai, ada beberapa requirements yang dibutuhkan agar kita bisa melakukan development aplikasi GWT-Ext menggunakan Eclipse, antara lain:

(more…)

GWT-Ext untuk aplikasi Web

Saturday, June 21st, 2008

GWT-ExtGWT-Ext lebih tepat dikatakan sebagai Javascript Wrapper menggunakan bahasa Java. GWT-Ext menggabungkan dua buah library, yang pertama GWT (Google Web Toolkit) dan Ext Js. GWT-Ext ini berada dalam lisensi LGPL sehingga bisa dipakai secara free alias gratis. GWT-Ext ini dikembangkan oleh beberapa developer dalam sebuah komunitas yang diawali oleh Sanjiv Jivan.

(more…)

Kolaborasi Apache dan Tomcat di Ubuntu

Thursday, May 29th, 2008

Hari kmaren, dapet tugas dari bos tentang gimana caranya Apache dan Tomcat bisa berkolaborasi. Maksudnya kolaborasi mungkin seperti ini, Tomcat container tetep jalan di port 8080 begitu juga Apache server berjalan di port 80. Namun, untuk mengakses Aplikasi Web Java tidak perlu lagi menggunakan definisi port 8080, tapi cukup menggunakan port 80 milik Apache server. Jadi seakan-akan Aplikasi Web Java di virtual host kan ke Apache server. Begituu… Tujuan nya sih untuk mengembakan sebuah aplikasi web baru berbasis java dari aplikasi web lama berbasis cgi (freepascal)

(more…)

Tapestry 5

Wednesday, January 30th, 2008

Since i’ve worked on one of IT Consultant Company in Surabaya, I often heard words about Tapestry. Until my friend, Dwi Ardi, introduce me about Tapestry. He introduce Tapestry to me because one of many campus project. So I must prepared my self to learn more about Tapestry. My first target to collect information about Tapestry is *always* mr. google. After all, this my little resume about Tapestry, hopely can bring benefit for us.

(more…)

Getting input from system * Java

Friday, January 25th, 2008

Last day, i’ve a course task about Design and Analysis Algorithm. It’s about Jolly Jumper. I’ve no problem about that algorithm but I have problem about how Java application can read a file from a value that passed on console parameter when a java class executed.thinks like this:

satria@terebinthia:~$ java jolly < input_file_name.txt

I’ve really no idea about it before, till H.Ferdianto tell me how java can receive console input like that (except from argument). Finally, now I can write code and finalize my course task. Here the simple code:

(more…)